Default dropdown list to database value

  • Thread starter Thread starter Kerri
  • Start date Start date
K

Kerri

Hi,

I have an aspx page with a drop down.

This is a page where a user can edit their user profile.

When they go to this page, I want the dropdownlists to
default to what it is in teh user table.

I have tried calling a function that renders out the
html, but my html looks like <asp:listitem> so it is not
interpreting the server side code.

Anyone know how to do this i.e. set the selected value to
that in the database and render out additional items in
the list?

Thanks,
Kerri.
 
Hi Kerri,

If I read your post correctly, you have a hard-coded list of items in the
dropdown list. As long as you have a runat="Server" on the asp:dropdownlist,
and it has an ID, you can code against it in the Form_Load event. I'd say
you have to then iterate through the items in the list, comparing every item
to the database value, and setting the Selected property on the correct
item.

Hope this helps

Thys Brits
MCSD/MCAD
 
Back
Top