public void LoadDiseaseGridView() { GetDiseasesList = aHeadOfficeManager.GetDiseasesList(); if (dt.Columns.Count == 0) { dt.Columns.Add("Serial No", typeof(string)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Description", typeof(string)); dt.Columns.Add("Treatment", typeof(string)); } int count = 1; foreach (var disease in GetDiseasesList) { DataRow NewRow = dt.NewRow(); NewRow[0] = count.ToString(); NewRow[1] = disease.Name; NewRow[2] = disease.Description; NewRow[3] = disease.Treatment; dt.Rows.Add(NewRow); count++; } DiseaseGridView.DataSource = dt; DiseaseGridView.DataBind(); }
protected void DiseaseGridView_PageIndexChanging(object sender, GridViewPageEventArgs e) { DiseaseGridView.PageIndex = e.NewPageIndex; DiseaseGridView.DataSource = dt; DiseaseGridView.DataBind(); }