DropDownList SelectedIndexChanged doesn't trigger UpdatePanel in SharePoint 2007 SP1
A week ago I had a nice page that was hosted in SharePoint and, among others, contained an updatepanel with a dropdownlist in it. Everything worked, and all was well. Because our testers had found some issues we had delivered two newer versions to our development environment. In the last version they found an issue that wasn't there before: selecting a different value in the dropdown did not only update the updatepanel, but resulted in a complete postback. My first idea was: that's an easy one, I'll check the triggers. Boy, was I wrong...
A few hours later, we had everything working again. But rebuilding the entire usercontrol didn't solve the issue, and neither did changeing all available settings for all controls ;). Weird thing was it did work when outside of a SharePoint environment. After some extensive searching, I found a post on Brian H. Madsen's blog, called Using DropDownList with an UpdatePanel in MOSS 2007. As it turns out, SP1 introduces a bug for working with dropdownlists, making that the SelectedIndexChanged event isn't captured by the update panel. Brian's post contains the code below which, if placed in the page_load, solves this issue:
if (this.Page.Form != null)
if (this.Page.Form.Attributes["onsubmit"] == "return _spFormOnSubmitWrapper();")
this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";
ScriptManager.RegisterStartupScript(this, this.GetType(), "UpdatePanelFixup",
"_spOriginalFormAction = document.forms.action;_spSuppressFormOnSubmitWrapper=true;", true);