protected void grdEmployee_PageIndexChanging(object sender, GridViewPageEventArgs e) { try { grdEmployee.PageIndex = e.NewPageIndex; List<string> listEmpId = new List<string>(); if (hdnAdvanceSearch.Value == "Normal") { if (ViewState["empListNormal"] != null) { listEmpId = (List<string>)ViewState["empListNormal"]; } foreach (GridViewRow row in grdEmployee.Rows) { CheckBox chkRow = (CheckBox)row.FindControl("chkRow"); CheckBox chkHeader = (CheckBox)row.FindControl("chkHeader"); HiddenField hdnEmployeeID = (HiddenField)row.FindControl("hdnEmployeeID"); if (chkRow.Checked) { if (!listEmpId.Contains(hdnEmployeeID.Value)) { listEmpId.Add(hdnEmployeeID.Value); } } else { if (listEmpId.Contains(hdnEmployeeID.Value)) { listEmpId.Remove(hdnEmployeeID.Value); } } } ViewState["empListNormal"] = listEmpId; BindEmployeeGrid(); } else if (hdnAdvanceSearch.Value == "Advanced") { if (ViewState["empListAdvanced"] != null) { listEmpId = (List<string>)ViewState["empListAdvanced"]; } foreach (GridViewRow row in grdEmployee.Rows) { CheckBox chkRow = (CheckBox)row.FindControl("chkRow"); HiddenField hdnEmployeeID = (HiddenField)row.FindControl("hdnEmployeeID"); if (chkRow.Checked) { if (!listEmpId.Contains(hdnEmployeeID.Value)) { listEmpId.Add(hdnEmployeeID.Value); } } else { if (listEmpId.Contains(hdnEmployeeID.Value)) { listEmpId.Remove(hdnEmployeeID.Value); } } } ViewState["empListAdvanced"] = listEmpId; BindAdvancedEmployeeGrid(); } } catch (Exception ex) { } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)