Click here to Skip to main content
15,921,660 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Dear All,

How to validate Checkbox inside gridview.

on my webpage i have Gridview with checkboxes in it, all the data is fill inside gridview.

below this gridview, i have submit button. NOW I want to validate Gridview checkboxes on submit button click.

I need code for this, Instead of Javascript.

Please help, Thanks.
Posted

try like this,
C#
for (int i = 0; i < GridView1.Rows.Count; i++)
{
    CheckBox CheckBox1 = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1");

    if (CheckBox1 != null)
    {
        if (CheckBox1.Checked)
        {
            //TODO
        }
    }
}
 
Share this answer
 
 
Share this answer
 
Comments
VICK 21-Oct-13 3:02am    
I need code for this, Instead of Javascript.

I think OP doesn't want any client side solution as mentioned in his question..:(
bjdestiny 21-Oct-13 3:18am    
OK.!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900