list control and default to selected item?

M

Moe Sizlak

Hi There,

I want to bind the value of a field from a database to make a dropdownlist
default to that value, I can't seem to get to work correctly. It just
doesn't seem work no matter what I do, could someone help me with some code?


Moe <><


lst1.SelectedItem.Value = Trim(dr("frm1value"))


<ASP:DropDownList id=lst1 name=lst1 maxlength= "40" runat=server>
<asp:ListItem Value="something">something</asp:ListItem>
<asp:ListItem Value="NO">NO</asp:ListItem>
<asp:ListItem Value="YES">YES</asp:ListItem>

</ASP:DropDownList>
 
S

stefano mostarda

Hi,

I use this:
lst1.SelectedValue = myValue;

HTH,
Stefano Mostarda MCP
Rome Italy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top