admin管理员组文章数量:1395730
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.
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.
- 9 Don't forget to put up some code, it makes it a lot easier to get help. – ProgrammingPope Commented Dec 3, 2009 at 16:37
- I have the same issue... anyone? – Jack Marchetti Commented Jul 21, 2010 at 15:16
- 1 What javascript are you using? I am unable to duplicate the issue with simple javascript, so please post the code that you are using so that we can try and help. – sgriffinusa Commented Jul 21, 2010 at 17:55
- I had this problem once before, can you post your web.config? – Nealv Commented Jul 28, 2010 at 15:16
5 Answers
Reset to default 4 +25I 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...
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./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.
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 :)
I had this problem once before, I solved it by changing my web.config
(check here)
Something that I have noticed is that the SelectedIndexChanged
event will not fire unless the value has been changed. So if your DropDownList's ListItems do not have unique values, just add a random number to make it unique.
Dim dt As DataTable
Dim dr As DataRow
Using d As DropDownList = ddl
With d
.Items.Clear()
dt = GetDataTable(Params)
' We add the index to the value field because the values need to be unique
' in order for the SelectedIndexChanged event to fire correctly
For k As Integer = 0 To dt.Rows.Count - 1
dr = dt.Rows(k)
.Items.Add(New ListItem(dr("column1"), k & ":" & dr("column2")))
Next
End With
End Using
本文标签: javascriptASPNET DropDown SelectedIndexChanged not firing in Firefox with UpdatePanelStack Overflow
版权声明:本文标题:javascript - ASP.NET DropDown SelectedIndexChanged not firing in Firefox with UpdatePanel - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744118116a2591608.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论