Hi There,
I am trying to default my listmenu to the stored value in the DB, the list itself is static but the values stored in the db are the same even in case.
I have tried 3 methods (below), has anyone got any better ideas?
Sean - thanks in advance for your answer
'lstRegion.Items.FindByText(dr("state"))
' lstRegion.Items.FindByValue(dr("state"))
lstRegion.SelectedItem.Value = dr("state")
<ASP:DropDownList id=lstRegion name=lstRegion maxlength= "40" CssClass="dropstyle" runat=server>
<asp:ListItem>Please Select</asp:ListItem>
<asp:ListItem Value="New South Wales">New South Wales</asp:ListItem>
<asp:ListItem Value="Victoria">Victoria</asp:ListItem>
<asp:ListItem Value="Tasmania">Tasmania</asp:ListItem>
<asp:ListItem Value="South Australia">South Australia</asp:ListItem>
<asp:ListItem Value="Western Australia">Western Australia</asp:ListItem>
<asp:ListItem Value="Northern Territory">Northern Territory</asp:ListItem>
<asp:ListItem Value="Queensland">Queensland</asp:ListItem>
</ASP:DropDownList>
lstRegion.Items.FindByValu
Or (even better):
lstRegion.SelectedValue = dr("state")