I would like to display all my category names in a drop down menu in the latest .net framework. So far, all I have is:
<asp:DropDownList ID="DDCategories" runat="server">
<asp:ListItem>
</asp:ListItem>
</asp:DropDownList>
Now I need in Code-Behind to tell the Dropdown that I would like to list all the Name under [Category] in my database. The reason for this is that I am going to create a product in which I would like to choose a category name, but I don’t know how to display them in a dropdown.
In case if you are using Linq2Sql or Entity Framework your code will looks like:
where
Categoryis generated collection for your table in DB.