G
Guest
I have a web form in which I'm selecting values of 10 different dropdownlists using a for each. I use DirectCast along with FindControl to get each dropdown and set the value. It seems that setting the SelectedIndex of the variable referencing my DropDownList changes the selectedindex of the 9 other dropdowns to match so the same SelectedIndex is set for every dropdown. I've stepped through, and I know the code is not setting the same selectedindex every time. The sp object referenced in my code below is a custom class that allows me to match up values to the list. IN the example below, sp.Attribute might = "VAL_1" which would result in finding a listitem with a value of "VAL_1
Here is the code
Dim ddlAttribute as DropDownLis
i=
For each sp in param
i+=
ddlAttribute = DirectCast(FindControl("ddlSearchAtt_" & i),DropDownList
ddlAttribute.SelectedIndex = ddlAttribute.Items.IndexOf(ddlAttribute.Items.FindByValue(sp.Attribute)
Nex
thanks in advanc
sk
Here is the code
Dim ddlAttribute as DropDownLis
i=
For each sp in param
i+=
ddlAttribute = DirectCast(FindControl("ddlSearchAtt_" & i),DropDownList
ddlAttribute.SelectedIndex = ddlAttribute.Items.IndexOf(ddlAttribute.Items.FindByValue(sp.Attribute)
Nex
thanks in advanc
sk