int j = 0; for (int i = 0; i < gridlob.Rows.Count; i++) { //finding checkbox in GridView CheckBox cbx = (CheckBox)gridlob.Rows[i].FindControl("chkReimbursable"); //CheckBox not null if (cbx != null) { //if CheckBox Checked if (cbx.Checked) { j++; //add your logic here. //this is for example to get first column values of selected CheckBox //string firstColumnValue = gridlob.Rows[i].Cells[0].Text; //Response.Write(firstColumnValue); if (j > 19) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ErrorAlert", "alert('Please select 19 lobs only');", true); } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)