Yes, the standard asp.net combo (drop-down) control has a AutoPostBack property. If this is set to true, changing the selected item in the combo causes a postback to the server and the SelectedIndexCh anged event fires.
(I'm pretty new to asp.net development, javascript and ajax myself, so I'm not 100% sure what is happening under the covers, but possibly the Javascript:setT imeout(....) call on the onchange client-side event is a result...
User Profile
Collapse
-
controlbox replied to Drop-down-list Client-side onchange stops Server-side SelectedIndexChanged event?in JavascriptSOLVED !!
for those of you who are interested...
render your own client-side javascript into the onchange like so...
control.Attribu tes["onchange"] = "Javascript :if (validateForm(' autopostback')= =false) return false;"
...then ajax will add on it's postback mechanism, so we end up with...
"Javascript :if (validateForm() ==false) return false;setTimeou t(....blah...Leave a comment:
-
controlbox replied to Drop-down-list Client-side onchange stops Server-side SelectedIndexChanged event?in Javascriptfurther investigation reveals that ajax is adding the following into the onchange attribute on the control...
setTimeout('__d oPostBack(\'ctl 00$phMain$ctlVe ssel\',\'\')', 0)
...so, if I have already added...
Javascript:retu rn validateForm();
...into the onchange attribute, we end up with...
Javascript:retu rn validateForm(); setTimeout('__d oPostBack(\'ctl 00$phMain$ctlVe ssel\',\'\')',...Leave a comment:
-
controlbox started a topic Drop-down-list Client-side onchange stops Server-side SelectedIndexChanged event?in JavascriptDrop-down-list Client-side onchange stops Server-side SelectedIndexChanged event?
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 AutoPostBack = true, and enable viewstate in order for the serverside events to fire, but once this was done, all seemed well - so far so good...
Also, when the page form is submitted, the Javascript validateForm() function is executed to perform... -
Many Thanks for the .Net solution. Do you know of a classic ASP solution?Leave a comment:
-
Programatically Determine IIS User Account?
Does anyone know a way to programatically determine the Windows Account IIS is using from inside an ASP or ASP.Net page?
No activity results to display
Show More
Leave a comment: