Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to get HTML ID and value in C# codefile

Posted on 2006-07-22
1
1,549 Views
Last Modified: 2012-05-05
How to get the value of what I have selected in this HTML

<select name="sel_mysel" id="sel_mysel">
<option value="1">Sel1</option>
<option value="2">Sel2</option>
<option value="3">Sel3</option>
</select>

in my c# codefile.... I and using asp.net 2.x



I don't want to use the
<asp:DropDownList ID="DropDownList1" runat="server">
    </asp:DropDownList>
Then I know how to do it
0
Comment
Question by:m-jansen
1 Comment
 
LVL 9

Accepted Solution

by:
jonorossi earned 50 total points
ID: 17160675
If you put a runat="server" on the select element node you can use it like a server control:
<select name="sel_mysel" id="sel_mysel" runat="server">

Example Codebehind:
        if (IsPostBack)
        {
            Response.Write(sel_mysel.Value);
        }
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question