I have the following onclick event for updating gridview rows that have changed. I need to update the rows if the user changes page index without clicking the update button first.
protected void btnUpdate_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
CheckBox chk = (CheckBox)row.FindControl("chkSelect");
if (chk.Checked)
GridView1.UpdateRow(row.RowIndex, false);
}
btnUpdate.Enabled = false;
BindToGrid();
}
Any help is greatly appreaciated.
Simple you can do is, create a method that will extract the fields and save the values to db and call it in both events