Link to home
Start Free TrialLog in
Avatar of sbornstein2
sbornstein2

asked on

ASP.Net/C# - Is there a way to make a group of checkboxes mutually exclusive?

Hi all.  This is not an easy one I beleive.  I am creating radiobuttons currently with a groupname all in code dynamically.  Well the user now needs to be able to deselect one.  I know I could create one more control with "none" as an option.  Is there a way though to create checkboxes that will do this?  Through my loop I create controls such as this in a control array and you can see I dynamically create its ID as well:

cbl.ID = "cbl" + count; //i.e. ID = rbl1_23
cbl.Attributes.Add("Price", formattedPriceControl);
cbl.Attributes.Add("ItemID", row["ItemID"].ToString());
myControls.Add(cbl.ID);
lit.Text = sbAddBookItems.ToString();
this.Form1.Controls.Add(lit);
this.Form1.Controls.Add(cbl);
cbl = new CheckBox(); //reset the CheckBoxList to a new one
lit = new Literal();
ASKER CERTIFIED SOLUTION
Avatar of Velio
Velio
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of divinewind80
divinewind80

My suggestion would be to use Javascript to accomplish your task.  Is this an option?