private void GetOldValues() { ArrayList arr; if (Session["SelectedRecords"] != null) arr = (ArrayList)Session["SelectedRecords"]; else arr = new ArrayList(); //Giving me an error "Object reference not set to an instance of an object." CheckBox chkAll = (CheckBox)gvManageJob.HeaderRow .Cells[0].FindControl("SelectAll"); for (int i = 0; i < gvManageJob.Rows.Count; i++) { if (chkAll.Checked) { if (!arr.Contains(gvManageJob.DataKeys[i].Value)) { arr.Add(gvManageJob.DataKeys[i].Value); } } else { CheckBox chk = (CheckBox)gvManageJob.Rows[i] .Cells[0].FindControl("chkdelete"); if (chk.Checked) { if (!arr.Contains(gvManageJob.DataKeys[i].Value)) { arr.Add(gvManageJob.DataKeys[i].Value); } } else { if (arr.Contains(gvManageJob.DataKeys[i].Value)) { arr.Remove(gvManageJob.DataKeys[i].Value); } } } } Session["SelectedRecords"] = arr; }
CheckBox chkAll = (CheckBox)gvManageJob.HeaderRow
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)