grid view paging problem. when i use paging it not give proper result..
-
public void grdbind() { try { con.Open(); SqlDataAdapter adp = new SqlDataAdapter("select UM_VC50_UserId,UM_IN4_Address_No_FK,UM_VC50_Role from T060011", ConfigurationManager.ConnectionStrings["cn2"].ConnectionString); DataTable dt = new DataTable(); adp.Fill(dt); grd_detail.DataSource = dt; grd_detail.DataBind(); // int gridID = 0, dtID = 0; Int32 i; for (i = 0; i < grd_detail.Rows.Count; i++) { // //dtID = Convert.ToInt32(dt.Rows[i]["UM_IN4_Address_No_FK"]); // for (int GridRowCount = 0; i < grd_detail.Rows.Count; GridRowCount++) // { // gridID = Convert.ToInt32(((Label)(grd_detail.Rows[GridRowCount].Cells[1].FindControl("lbl_sr"))).Text); // if (dtID == gridID) string role = dt.Rows[i][2].ToString(); if (role == "A") { CheckBox chk = new CheckBox(); chk = ((CheckBox)grd_detail.Rows[i].Cells[0].FindControl("chk1")); chk.Checked = true; } } } catch (Exception ex) { } }
-
public void grdbind() { try { con.Open(); SqlDataAdapter adp = new SqlDataAdapter("select UM_VC50_UserId,UM_IN4_Address_No_FK,UM_VC50_Role from T060011", ConfigurationManager.ConnectionStrings["cn2"].ConnectionString); DataTable dt = new DataTable(); adp.Fill(dt); grd_detail.DataSource = dt; grd_detail.DataBind(); // int gridID = 0, dtID = 0; Int32 i; for (i = 0; i < grd_detail.Rows.Count; i++) { // //dtID = Convert.ToInt32(dt.Rows[i]["UM_IN4_Address_No_FK"]); // for (int GridRowCount = 0; i < grd_detail.Rows.Count; GridRowCount++) // { // gridID = Convert.ToInt32(((Label)(grd_detail.Rows[GridRowCount].Cells[1].FindControl("lbl_sr"))).Text); // if (dtID == gridID) string role = dt.Rows[i][2].ToString(); if (role == "A") { CheckBox chk = new CheckBox(); chk = ((CheckBox)grd_detail.Rows[i].Cells[0].FindControl("chk1")); chk.Checked = true; } } } catch (Exception ex) { } }
make the gridview paging property true and write fire the event of grid view paging. or follow the code. eg. { protected void grdemp_PageIndexChanging(object sender, GridViewPageEventArgs e) //grdemp is ame of grid view { grdemp.PageIndex = e.NewPageIndex; } } Regards Keyur Satyadev
-
make the gridview paging property true and write fire the event of grid view paging. or follow the code. eg. { protected void grdemp_PageIndexChanging(object sender, GridViewPageEventArgs e) //grdemp is ame of grid view { grdemp.PageIndex = e.NewPageIndex; } } Regards Keyur Satyadev
i did that the problem is not that .. i have solved it but thnx for response.