473,387 Members | 1,388 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.

drop down list box - client side code won't execute OnSelectedIndexChange

I am trying to get a client side javascript function to invoke when the
selection changes in a drop down list box. I have tried :

ddl_specs.Attributes["language"] = "javascript";
ddl_specs.Attributes["OnSelectedIndexChanged"] = "return
OnChangeSpec();";

with & without the "return"; and with & without AutoPostBack = true on
the list box property and the javascript function just will not
execute.

I have gotten client side java script to work on an asp:button by
adding the javascript function via the attributes collection, so I am
not sure what else could be going on here.

Much Thanks.

Dec 1 '05 #1
5 3642
The client-side event name is "onchange", e.g.
ddl_specs.Attributes.Add ("onChange", "OnChangeSpec();");

SelectedIndexChanged is the server-side event which can be used as this:
ddl_specs.SelectedIndexChanged +=new
EventHandler(ddl_specs_SelectedIndexChanged);
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"ez******@hotmail.com" wrote:
I am trying to get a client side javascript function to invoke when the
selection changes in a drop down list box. I have tried :

ddl_specs.Attributes["language"] = "javascript";
ddl_specs.Attributes["OnSelectedIndexChanged"] = "return
OnChangeSpec();";

with & without the "return"; and with & without AutoPostBack = true on
the list box property and the javascript function just will not
execute.

I have gotten client side java script to work on an asp:button by
adding the javascript function via the attributes collection, so I am
not sure what else could be going on here.

Much Thanks.

Dec 1 '05 #2
Thanks! Where would I have found this? (besides posting the
question).

Dec 1 '05 #3
You are welcome.

The ASP.NET web server controls render HTML objects on the browser.
Therefore to manipulate any server control on the browser (using custom
JavaScript) one has to study the HTML objects that they render. For example
the DropDownList server control renders an HTML object named <SELECT> on the
browser. By searching the MSDN for documentation on SELECT you would get its
properties and events:

http://msdn.microsoft.com/library/de...cts/select.asp

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"ez******@hotmail.com" wrote:
Thanks! Where would I have found this? (besides posting the
question).

Dec 1 '05 #4
There are probably many places, but here is one of my favorite sites as a
reference for Javascript code (and other languages commonly used on the
web):

http://www.devguru.com/Technologies/...nthandler.html

Good luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
<ez******@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Thanks! Where would I have found this? (besides posting the
question).

Dec 2 '05 #5
The proper javascript event for drop down lists is onChange.

ddl_specs.attributes.add("onchange","return OnChangeSpec();")

----
700cb Development, Inc.
http://www.700cb.net
..NET utilities, developer tools,
and enterprise solutions

ez******@hotmail.com wrote in news:1133463351.201242.34780
@g47g2000cwa.googlegroups.com:
I am trying to get a client side javascript function to invoke when the
selection changes in a drop down list box. I have tried :

ddl_specs.Attributes["language"] = "javascript";
ddl_specs.Attributes["OnSelectedIndexChanged"] = "return
OnChangeSpec();";

with & without the "return"; and with & without AutoPostBack = true on
the list box property and the javascript function just will not
execute.

I have gotten client side java script to work on an asp:button by
adding the javascript function via the attributes collection, so I am
not sure what else could be going on here.

Much Thanks.


--
Dec 4 '05 #6

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

Similar topics

46
by: Kingdom | last post by:
In my data base I have a list of componet types e.g. type A - I have 8 off - type B I have 12 off etc. I'm using Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM Parts_Table") ...
9
by: Matt | last post by:
I have 2 drop down boxes. When the user changes the values in one drop down box, the values in another drop down box will be changed on the fly. Is it possible to do that? in client side or...
5
by: SirPoonga | last post by:
I think I'd have to do a combination of ASP and javascript to do this. What I want to do fill the first drop down box with values from a database query. Then based off that selection fill in the...
4
by: Terren | last post by:
I need to be able to edit a drop down box is asp. On my web app I populate a drop down box from a databse. The user can then select an option that will then be saved to a Database for example Mr...
3
by: pmud | last post by:
Hi, I have a drop down list bound to a database thorugh a data reader. It reads the customer names from data reader. Now, I want the user to be able to type more than one alphabet & the list...
1
by: PB | last post by:
I have an aspx with 4 Drop-Down list boxes on it. All the list values are hard-coded in the aspx. I want a client-side JavaScript function to select a value in each of those DDLs. I can...
3
by: John Walker | last post by:
Hi, On an ASP.NET page I have a drop down list control. When the user pulls down the list and makes a selection, I perform validation, and if the validation fails I want the selected item in...
7
controlbox
by: controlbox | last post by:
I have recently inplemented some drop-down lists (combos) on a page where one is dynamically populated according to the selection of another using the microsoft ajax extensions. I had to set...
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: 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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.