0

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?

2
  • 1
    Try this <asp:DropDownList ID="DropDownList1" runat="server"> </asp:DropDownList> Commented May 24, 2015 at 8:40
  • umm.. the CSS classes? @PradnyaBolli Commented May 24, 2015 at 8:44

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Doesn't work. A very messed up drop down list appears inside the HTML drop down list
because you need to change your css class to properly style a select element.
0

You can use "Request.Form["Control Name"]".

Please find attached Example Link

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.