setting DropDownList value
-
I have a table in a database with certain fields which the user fills up through a form.At a later point,if the user wishes to see this form,I need to auto-fill those fields.The auto-fill works except for the DropDownList control.It always sets its field to the first item in the datalist.I tried 'DropDownList2.Items.FindByText(string).selected="True"' but it shows an error. I need the dropdownlist to show the text that was previously selected by the user and also giving the user an option to change his previous selection. How do i do this?
-
I have a table in a database with certain fields which the user fills up through a form.At a later point,if the user wishes to see this form,I need to auto-fill those fields.The auto-fill works except for the DropDownList control.It always sets its field to the first item in the datalist.I tried 'DropDownList2.Items.FindByText(string).selected="True"' but it shows an error. I need the dropdownlist to show the text that was previously selected by the user and also giving the user an option to change his previous selection. How do i do this?
DropDownList.Items.IndexOf(DropDownList.Items.FindByValue("InsertValueToFind")) That is one of the ways I do it.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
-
DropDownList.Items.IndexOf(DropDownList.Items.FindByValue("InsertValueToFind")) That is one of the ways I do it.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
-
Do you set the value of the DropDownList, or just the text?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
-
Try the FindByText one.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo