G
Guest
How do i make a dropdownlist selected value based on the value i retrive from
the database.
Basically i have an edit page and like to display the default value in a
dropdown list from the database.
for example: if the ddl_value is 2 from the database i want the second list
item to be selected by default.
<aspropDownList id="ddl" runat="server">
<asp:ListItem Value="0">value 1</asp:ListItem>
<asp:ListItem Value="1">value 2</asp:ListItem> // make this dynamically
selected
<asp:ListItem Value="0">value 3</asp:ListItem>
<asp:ListItem Value="1">value 4</asp:ListItem>
</aspropDownList>
I am using the dropdownlist inside a repeater.. and only retriving single
record at a time based on a querystring... and using a datareader to fill the
form.
Many thanks in advance..
the database.
Basically i have an edit page and like to display the default value in a
dropdown list from the database.
for example: if the ddl_value is 2 from the database i want the second list
item to be selected by default.
<aspropDownList id="ddl" runat="server">
<asp:ListItem Value="0">value 1</asp:ListItem>
<asp:ListItem Value="1">value 2</asp:ListItem> // make this dynamically
selected
<asp:ListItem Value="0">value 3</asp:ListItem>
<asp:ListItem Value="1">value 4</asp:ListItem>
</aspropDownList>
I am using the dropdownlist inside a repeater.. and only retriving single
record at a time based on a querystring... and using a datareader to fill the
form.
Many thanks in advance..