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[0].action;_spSuppressFormOnSubmitWrapper=true;", true);

Published Fri, Mar 21 2008 4:32 PM by Rick van den Bosch
Filed under: , ,

Comments

# DropDownList doesn't trigger UpdatePanel in SharePoint 2007 SP1

You've been kicked (a good thing) - Trackback from DotNetKicks.com

Friday, April 11, 2008 4:01 PM by DotNetKicks.com

# re: DropDownList SelectedIndexChanged doesn't trigger UpdatePanel in SharePoint 2007 SP1

I'm new at integrating ajax with sharepoint but your topic is exactly what's happening with my site.

I've created a webpart and my controls are added to the updatepanel.  Within the class I've created a handler for the onclick event of a button.  The event is been fired but the page (Master page) in sharepoint does not refresh with the changes caused by the click event.

Also, I'm using the SelectedIndexChanged event to populate dropdownlists.  When I select an item in the list the page does a full refresh.  These controls are also added to the updatepanel.  They show up on the page in sharepoint but do not function properly.  Your code example is simple.  I'm using vb.net and in my class I don't have access to the page_load event.  Would you mind pointing me in the right direction?

regards,

amorris01@yahoo.com

Wednesday, April 30, 2008 7:39 PM by Morris

# re: DropDownList SelectedIndexChanged doesn't trigger UpdatePanel in SharePoint 2007 SP1

It really worked with the updatepanel and can u please let me know how to apply triggers concept of ajax to the sharepoint.Is some code need to be added to the Page load event to apply triggers concept?

Tuesday, July 08, 2008 7:01 AM by Loki

# re: DropDownList SelectedIndexChanged doesn't trigger UpdatePanel in SharePoint 2007 SP1

grt solution it really worked :)

Thursday, August 27, 2009 11:43 AM by Sonal

# re: DropDownList SelectedIndexChanged doesn't trigger UpdatePanel in SharePoint 2007 SP1

It does not work for me

Friday, November 20, 2009 10:25 AM by test

# re: DropDownList SelectedIndexChanged doesn't trigger UpdatePanel in SharePoint 2007 SP1

Fantastic solution and it works for me!

but strangely even though i installed MOSS 2007 SP2, the bug still exists!

I guess the bug for SP1 is not fixed even though i installed SP2?

Tuesday, December 22, 2009 2:39 AM by Eric

# re: DropDownList SelectedIndexChanged doesn't trigger UpdatePanel in SharePoint 2007 SP1

Hi

I have the same problem and it is not working only on mysite. Same control is working on other site. Pl. advise urgently.

Friday, April 02, 2010 6:13 AM by sandeepsahni

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Please add 2 and 3 and type the answer here: