tcmmaxt
asked on
how do i bind dropdownlist to database asp .net C#
Expert: I have a .net asp app with an INSERT and EDIT mode and a dropdownlist with 3 items "Choose type of expert" , "expert" and "superexpert" to choose form repectively. I want to bind the dropdownlist with a back ended database such that when user chooses one of these items I want to set a datafield called "ExpertType" with the selected item. I am not sure how to bind the dropdownlist for insert and edit mode. Could you please fix my rough code below so it binds and works correctly. When web page first appears dropdownlist default is "Choose type of expert" . thanks for any help here.
<asp:DropDownList ID="ExpertDdl" runat="server"
SelectedValue='<%# Bind("ExpertType") %>'Width="92px">
<asp:ListItem Selected=True Value="-1">-- Choose type of expert--</asp:ListItem>
<asp:ListItem Text="expert" Value="expert"></asp:ListItem>
<asp:ListItem Text="superexpert" Value="superexpert"></asp:ListItem></asp:DropDownList>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.