473,387 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Getting DropDownList selected value

Jon
Hello all,

Through JavaScript, I add a row to a DataGrid. This new row has a number of
columns, one of which contains a SELECT control with a couple of items -
again, all done through JavaScript.

My question is, how on the page postback, in the page's codebehind, do I get
a reference to this SELECT contol so that I get the selected value.

Thanks all,

Jon
Apr 24 '06 #1
3 1889
Jon,

Whatever you add in javascript is not available on server side unless you
pass it on there specifically.

Introduce a hidden input control and pass the selected value in it.

Eliyahu
"Jon" <Jo*@discussions.microsoft.com> wrote in message
news:8C**********************************@microsof t.com...
Hello all,

Through JavaScript, I add a row to a DataGrid. This new row has a number
of
columns, one of which contains a SELECT control with a couple of items -
again, all done through JavaScript.

My question is, how on the page postback, in the page's codebehind, do I
get
a reference to this SELECT contol so that I get the selected value.

Thanks all,

Jon

Apr 24 '06 #2
if your javascript set the name to the <select>, when posted back, your code
behind can look it up by the same name in the Request.Form collection by its
name. if you don't know the name use a pattern and loop thru the collection
looking for the name pattern.

note: if you name two (or more) controls the same, the server creates a
comma seperated list as the value in the form collection for the controls.
-- bruce (sqlwork.com)

"Jon" <Jo*@discussions.microsoft.com> wrote in message
news:8C**********************************@microsof t.com...
Hello all,

Through JavaScript, I add a row to a DataGrid. This new row has a number
of
columns, one of which contains a SELECT control with a couple of items -
again, all done through JavaScript.

My question is, how on the page postback, in the page's codebehind, do I
get
a reference to this SELECT contol so that I get the selected value.

Thanks all,

Jon

Apr 24 '06 #3
Jon
Thats just the ticket Bruce, thanks very much!

"bruce barker (sqlwork.com)" wrote:
if your javascript set the name to the <select>, when posted back, your code
behind can look it up by the same name in the Request.Form collection by its
name. if you don't know the name use a pattern and loop thru the collection
looking for the name pattern.

note: if you name two (or more) controls the same, the server creates a
comma seperated list as the value in the form collection for the controls.
-- bruce (sqlwork.com)

"Jon" <Jo*@discussions.microsoft.com> wrote in message
news:8C**********************************@microsof t.com...
Hello all,

Through JavaScript, I add a row to a DataGrid. This new row has a number
of
columns, one of which contains a SELECT control with a couple of items -
again, all done through JavaScript.

My question is, how on the page postback, in the page's codebehind, do I
get
a reference to this SELECT contol so that I get the selected value.

Thanks all,

Jon


Apr 25 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Stanley J Mroczek | last post by:
How do you load a dropdownlist when edit is clicked in a datagrid ? <Columns> <asp:BoundColumn DataField="OptionDescription" ItemStyle-Wrap="True" HeaderText="Option...
1
by: DC Gringo | last post by:
I'm having such a problem with this DropDownList in a user control that is posting back and throwing an error: System.Web.HttpException: A DropDownList cannot have multiple items selected ...
4
by: Rob Venable | last post by:
Hi all, Can anyone tell me how to retrieve the ID of a selected item from a DropDownList. My query brings back the ID and value and I cycle through the .Read Method to add items to the...
6
by: Julius Fenata | last post by:
Dear all, I have created client-side scripting to trigger event onChange from code-behind, like this: DropDownList1.Attributes = "GenerateArticleID()"; At the script on Windows Form, I...
1
by: Paul L | last post by:
Hi, I have an issue with the OnSelectedIndexChanged event not firing for a DropDownList control which is in the ItemTemplate of a DataList. I have made an exact copy of the DropDownList control,...
2
by: Antonio D'Ottavio | last post by:
Good morning, I've a problem with a dropdownlist located inside any row of a datalist, I fill both datalist and dropdownlist at runtime, the problem is with the dropdownlist infact using the event...
5
by: Nathan Sokalski | last post by:
I have a user control that contains three variables which are accessed through public properties. They are declared immediately below the "Web Form Designer Generated Code" section. Every time an...
3
by: Iain | last post by:
Hi All I have 2 DropDownList boxes on a page. The first (id= "Operation") is populated on PageLoad with the contents of a database table. The second id="WorkStations" will not be populated...
1
by: imranabdulaziz | last post by:
Dear All, I am mess with one situation let me explain the scenario. I am making search form where I display 15 field in checkboxlist and user select one or two or three or any no to all field....
2
by: mylog | last post by:
Hi I am having a problem of getting the value from the dynamically generated table and dropdownlist. What I am facing is, I have created a table in the aspx page and now I need to add values to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.