Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Setting Javascript as an argument to new eventhander?

Thread Tools

Setting Javascript as an argument to new eventhander?

Posts: n/a
I have a combobox on an page. I would like to enable or
disable other controls on this page dependent upon what is selected in
the combobox.

My combobox is created dynamically on page_load. I would like to set
its SelectedIndexChanged to some javascript that I have defined in the
HTML portion of my ASPX.

I do not want to go to the server to handle my 'onchanged' event.

Any ideas on how to do this? Or maybe you have a better way to
accomplish what I would like to do?

Reply With Quote
Alex Homer
Posts: n/a
You can handle the client-side onchange event by adding the event handler
name to the control in ASP.NET:

dropdownlist.Attributes.Add("onchange", "myeventhandler")

then include the client-side script:

function myeventhandler()
... whatever ...

for details of the client-side events of the <select> list

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
function argument dependent on another function argument? Reckoner Python 11 01-19-2009 03:31 AM
Template argument as template argument nw C++ 0 04-14-2008 01:36 PM
Function pointers, variable argument functions calling other variable-argument functions (sort of) S?ren Gammelmark C Programming 1 01-07-2005 09:41 PM
How to pass variable argument list to another function w/ variable argument list? Ben Kial C Programming 1 11-15-2004 01:51 AM
defaulting argument to previous argument Bhushit Joshipura C++ 5 12-30-2003 03:21 PM