I've set up a CheckBoxList to take a selection from a user, and bound it to my database (MySQL) so that it does a
SELECT DISTINCT manufacturer FROM basevehicle; and populates the check box with the result.
Everything works fine but when it comes to checking a box, the CheckBoxList allows you to select more than one box.
I've worked around this problem with the following code:
CODE
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
//get the manufacturer that the user selected
string manufSelect = CheckBoxList1.SelectedValue.ToString();
Label1.Text = manufSelect;
//Disable the check box so only one box can be selected
CheckBoxList1.Enabled = false;
}
I have enabled AutoPostBack in the designer, so that the check box gets disabled after a selection is made.
What I would like to do though, is not to disable the check box, but still only take one check.
How can I do this?
This post has been edited by Footsie: 10 Feb, 2008 - 05:37 AM