tags:

views:

31

answers:

1

I have to select checkboxes besed on group column values. If you see below gridview, column 3 (GroupNo) has 1,1,1,1,2,2,2,2....etc (this column data is not static, will change based on page index. i.e PageIndex =2 may starts with 7,7,7,8,8,8,8,8,9,9,9 etc).

Now My question is.

In every sectio/Group User must and should select minimun 2 check boxes. so If user select only one check box we need to show a pop up message as " Please select One more check box in that particular section" If User skips the message and move to next section we have to show the same message. We have to force the user to select more than one checkbox in the same section.

Mainly our intention is the check boxes whatever user selected in each section/Group belongs to one Category.

Please help me in this requirement. Thanks in advance.

alt text

A: 

you need to use custom Validator and need to check this in code behind to iterate gridview rows Edit: Something like you need to add more checks.....

int GroupCount = 0;
 for (int count = 0; count < grd.Rows.Count; count++)
{
    int GroupNo = ((label)grd.Rows[count].FindControl("yourGroupNoLable")).Text;
    if (((CheckBox)grd.Rows[count].FindControl("yourCheckbox")).Checked)
    {
        GroupCount = GroupCount + 1;
    }
}
Muhammad Akhtar
Please can you provide code or elaborate?.
James123
I think, you did not understand my problem. I have to force to select morethan one section.
James123
that's what you need to count GroupCount and then you need to again put check
Muhammad Akhtar