[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Get HTML Select Box Value in C#

Posted on 2006-04-28
8
Medium Priority
?
812 Views
Last Modified: 2008-03-17
Hi,

in my C#, if I were using a DropDownList I would get the value using

dropdownlist.SelectedValue

how do I get the value if it is a normal HTML select box, with a runat+"server" and ID in?

0
Comment
Question by:REA_ANDREW
  • 4
  • 3
8 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 16561495
Hi REA_ANDREW,

dropdownlist.value

Tim Cottee
0
 
LVL 20

Author Comment

by:REA_ANDREW
ID: 16561504
cheers, something wierd happening here

I used to be able to invoke a function using an onchange event in the select tag, using a runat="server" and also an ID.

it will not let me this time.

even using the onserverchange, no error but nothing is fired.

<select id="Select1" runat="server" onserverchange="Select1_ServerChange">
         <option value="1">1</option>
         <option value="2">2</option>
         <option value="3">3</option>
     </select>
0
 
LVL 20

Author Comment

by:REA_ANDREW
ID: 16561509
to debug I used a simple response.write here

protected void Select1_ServerChange(object sender, EventArgs e)
    {
        Response.Write("boo");
    }
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
LVL 9

Expert Comment

by:daniel_balla
ID: 16561782
why not make it an asp dropdown instead of the HTML select control?
0
 
LVL 20

Author Comment

by:REA_ANDREW
ID: 16561933
well I am unable to populate the ASP Dop Down list with Javascript using the ATLAS XML Response.

With a select I can use

MySelect.options = new Option("value","text");

By any chance do you know how to populate a drop down list with JavaScript?
0
 
LVL 9

Accepted Solution

by:
daniel_balla earned 2000 total points
ID: 16562034
you can populate it just like a select because it is a select, but in order to get the ID you wouldhave to use the ClientID property of the control
0
 
LVL 20

Author Comment

by:REA_ANDREW
ID: 16562082
LOL, THANKYOU AT LAST

lol, I have been searching the internet for that one.  ah tell you, cheers for that.

here are the points.  I am opening another question next, I hope you will take part, as you seem to know your stuff.

I have add a refernce to my script and input all the relevant source code into the web.config file. But it will not find it. Will put in the next question

Thanks Again.

GRADE A
0
 
LVL 9

Expert Comment

by:daniel_balla
ID: 16562185
thanks. hope it helps.

not sure I understand the reference and web config issue though.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
Suggested Courses

608 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