The process I am doing is that if it lbl.Textis "Validated" then uncheck the box accordingly in the grid. The code works fine if there is no paging. Now the problem is that I use paging, and when I click on the next grid page, the checked things are displayed with the checkbox turned on.
I checked through breakpoints. It loads the previous grid values during page load. And after pageloadevent starts its development and loads the new values into the grid.
protected void Page_Load(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
Label lbl = (Label)row.FindControl("Labely8");
Label Label23 = (Label)row.FindControl("Label23");
CheckBox checkbox = (CheckBox)row.FindControl("chkRows");
if (lbl.Text == "Validated")
{
checkbox.Enabled = false;
}
else
{
checkbox.Enabled = true;
}
}
}
source
share