views:

525

answers:

4

I have an asp:Updatepanel that contains a dropdown and I run some Javascript on the onchange event of the dropdown. I also fire some server side code on the selectedindexchanged of the dropdown.

This works OK in IE, but in Firefox the selectedindexchanged event never gets called.

I think this may be something todo with onchange and selectedindexchanged conflicting but, I can't find a solution to solve this.

A: 

I'm pretty sure that you have some problems in client side since There has been similar reports. Use firebug to track the js error. have a look at http://www.webmasterworld.com/profilev4.cgi?action=view&member=Nazgoth about ochange event in firefox. If you can't find the source of your problem, post your js here.

Kamyar
No js errors to report.
Jack Marchetti
A: 

Feel free to correct me as this was my solution a very very long time ago:

We hit this and the only way we ended up being able to do it was to attach an event to the id of the dropdown itself and access it via document.getElementById (easy enough to find the id with a view source :)

Lame answer with a lame solution but that's how we got around the issue a few years back. Would be interested if anyone actually knows how to fix it :)

jamie-wilson
+2  A: 

I would agree with some of the other posters here. IE, Chrome, and FF seem to handle server-side controls with both client-side and server-side events handlers differently. It has been my experience that sometimes they wait for the client JavaScript to end, then perform the post-back to handle the server-side...but this isn't always the case.

The solution I always turn to:

Go ahead and set the onChange() event on your DropDownList only...then in your JavaScript, manually force the postback using something like the

__doPostBack('<%= DropDownList.ClientID %>', '');

syntax to make your page use that control for the postback. In your server-side code you can just query the current index value off the DropDownList, and perform whatever processing you want...the UpdatePanel should handle this situation perfectly...

fdfrye
I've had probably the same issue.. It was soo strange Firefox wouldn't fire a postback on 2 of my dev computers but on a third it was fine (this was on a linkbutton).. It mean't we had to move to IE for demo purposes.. I will try fdfrye's suggestion.. It looks very plausible
Markive
A: 

I had this problem once before, I solved it by changing my web.config

(check here)

Nealv