V
Vi
Hi,
I'm getting the error "Cannot have multiple items selected in a
DropDownList" when I'm trying to select a specific value in a
System.Web.UI.WebControls.DropDownList by using the code:
ddl.SelectedValue = "3";
I'm not setting it to any other value anywhere in the code. All I'm doing
with that list is populating it by DataBind-ing it to a SqlReader and then
adding an additional ListItem to it:
ddl.Items.Insert(0, oItem);
I guess ddl.Items.Insert() also selects the inserted value, since if I
comment out this line I don't get the error anymore.
Does anybody know how to fix this or should I just create some client side
code that will run after the page loads and will make all the selectios?
Thanks
I'm getting the error "Cannot have multiple items selected in a
DropDownList" when I'm trying to select a specific value in a
System.Web.UI.WebControls.DropDownList by using the code:
ddl.SelectedValue = "3";
I'm not setting it to any other value anywhere in the code. All I'm doing
with that list is populating it by DataBind-ing it to a SqlReader and then
adding an additional ListItem to it:
ddl.Items.Insert(0, oItem);
I guess ddl.Items.Insert() also selects the inserted value, since if I
comment out this line I don't get the error anymore.
Does anybody know how to fix this or should I just create some client side
code that will run after the page loads and will make all the selectios?
Thanks