Click here to Skip to main content
15,888,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,


I have a repeater with checkboxes in asp.net using c#,

I want to Count the no.of rows in which checkboxes are checked.

can anyone plz help me, how to do..


thnx
Posted

1 solution

try like below
C#
int count =0;
foreach (RepeaterItem item in YourRepeater.Items)
{
    if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
    {
        var checkBox = (CheckBox)item.FindControl("checkboxName");
        if(checkBox.Checked)
            count++;
    }
}
 
Share this answer
 
Comments
abdul subhan mohammed 21-May-14 12:26pm    
Thnx dude
DamithSL 21-May-14 12:33pm    
You are welcome!

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