Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 9435 | Replies: 3
![]() |
hi all,
do anyone knows how to create a dynamic dropdownlist? the dropdownlist will retrieve the list items from database..
eg: below is code for static dropdownlist where i declare the listitem myself.. but how should i declare listitem retreive from database?
thanks..
do anyone knows how to create a dynamic dropdownlist? the dropdownlist will retrieve the list items from database..
eg: below is code for static dropdownlist where i declare the listitem myself.. but how should i declare listitem retreive from database?
<asp:dropdownlist id="ddl" Runat="server">
<asp:ListItem Value="1">A</asp:ListItem> <asp:ListItem Value="2">B</asp:ListItem> <asp:ListItem Value="3">C</asp:ListItem>
</asp:dropdownlist>thanks..
cheers,
ohgosh
ohgosh
•
•
Join Date: Jul 2005
Location: Dallas, TX
Posts: 482
Reputation:
Rep Power: 4
Solved Threads: 19
if you can get the information out of the database and into a DataTable all you need to do is:
if you need help getting it from the database into the datatable let me know
DropDownList1.DataSource=dataTableName; DropDownList1.DataTextField="NameofDatabaseColumn"; DropDownList1.DataValueField="NameofDatabaseColumn"; DropDownList1.DataBind();
if you need help getting it from the database into the datatable let me know
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode