I think this is the first time I put a dropdownlist in a web form, it
correctly displays the values from the database and when I save the
form I'm able to save the corresponding value to the database. But when
I use the form to display data, the listbox does not automatically
display the value saved in the database of course, so how am I supposed
to make point to the saved value ?Hi,
You can do it one of two ways.
(after ddl is populated)
DropDownList.SelectedIndex =
DropDownList.Items.IndexOf(DropDownList.Items.Find ByText(MyDataReader("FieldName")))
or
(if before ddl is populated)
DropDownList.DataTextField=MyDataReader("FieldName")
I hope this helps.
Mike Douglas
On 26 Mar 2005 16:17:20 -0800, craigkenisston@.hotmail.com wrote:
>Hi,
>I think this is the first time I put a dropdownlist in a web form, it
>correctly displays the values from the database and when I save the
>form I'm able to save the corresponding value to the database. But when
>I use the form to display data, the listbox does not automatically
>display the value saved in the database of course, so how am I supposed
>to make point to the saved value ?
0 comments:
Post a Comment