Reputation: 5074
I need to write this HTML Dropdown control in ASP.NET with the runat=server tags to retrieve its selection in the code behind. I'm a bit confused how to add the runat tags and make it an ASP control.
<div class="wrapper-demo" style="margin-left:0;">
<div id="dd2" class="wrapper-dropdown-1" tabindex="1">
<span>To :</span>
<ul class="dropdown" tabindex="1">
<li> <a href="#"> Arabic </a> </li>
<li> <a href="#"> Bengali </a> </li>
<li> <a href="#"> Chinese </a> </li>
<li> <a href="#"> Czech </a> </li>
</ul>
</div>
</div>
Can yall help out a bit?
Upvotes: 0
Views: 213
Reputation: 87
You can use "Request.Form["Control Name"]".
Please find attached Example Link
Upvotes: 0
Reputation: 427
Convert to this code:
<div class="wrapper-demo" style="margin-left:0;">
<div id="dd2" class="wrapper-dropdown-1" tabindex="1">
<span>To :</span>
<asp:DropDownList ID="dropDown1" runat="server" CssClass="dropdown">
<asp:ListItem Text="Arabic" Value="0" />
<asp:ListItem Text="Bengali" Value="0" />
<asp:ListItem Text="Chinese " Value="0" />
<asp:ListItem Text="Czech " Value="0" />
</asp:DropDownList>
</div>
</div>
However ASP.NET will render select
element, not ul
list.
Upvotes: 4