Return Selected checkbox values
public Hashtable returnGridSelectedIds(GridView gv1, string chkBoxField) { string Id = ""; Hashtable ht = new Hashtable(); if (gv1.Rows.Count > 0) { foreach (GridViewRow gvr in gv1.Rows) { HtmlInputCheckBox htmChkBox = (HtmlInputCheckBox)gvr.FindControl(chkBoxField); if (htmChkBox.Checked) Id += htmChkBox.Value + ","; } } if (Id.ToString() != "") Id = Id.Substring(0, Id.Length - 1); ht["Ids"] = Id; return ht; }