1

Closed

Incompatibility with UpdatePanel

description

Some controls' scripts are incompatible with UpdatePanel.
Needs investigation
Closed Nov 12, 2007 at 8:58 AM by artificeren
Fixed with source code update 13747

comments

soulsolutions wrote Mar 10, 2008 at 6:43 AM

Ah this does not appear to be fixed for all controls.
The issue is around the use of Page.ClientScript to register the javascript while in the update panel you need to use the scriptmanager.
This is a great article if you want to make both ways work without a reference to system.web.extensions:
[URL:http://forums.asp.net/p/1040033/1445844.aspx]
This is an example of updating the duallist control to use the scriptmanger (also need to update DynamicListBox to make it work):

protected virtual void RegisterScript()
{
if ( this.Page != null && !this.AutoPostBack )
{
//ClientScriptManager script = Page.ClientScript;
ScriptManager.RegisterClientScriptResource(Page, typeof(DualList), "MetaBuilders.WebControls.Embedded.DualListScript.js");
//script.RegisterClientScriptResource(typeof(DualList), "MetaBuilders.WebControls.Embedded.DualListScript.js");
ScriptManager.RegisterStartupScript(Page, typeof(DualList), "DualListScript", "MetaBuildersDualListInit(); " + String.Format(Resources.AjaxWorkaroundScript, "MetaBuildersDualListInit"), true);
//script.RegisterStartupScript( typeof( DualList ), "DualListScript", "MetaBuildersDualListInit(); " + String.Format( Resources.AjaxWorkaroundScript, "MetaBuildersDualListInit" ), true );

StringBuilder objInit = new StringBuilder();
objInit.Append( "{ LeftBoxID:'" );
objInit.Append( this.leftBox.ClientID );
objInit.Append( "', " );
objInit.Append( "RightBoxID:'" );
objInit.Append( this.rightBox.ClientID );
objInit.Append( "', " );
objInit.Append( "MoveRightID:'" );
objInit.Append( this.moveRight.ClientID );
objInit.Append( "', " );
objInit.Append( "MoveAllRightID:'" );
objInit.Append( this.moveAllRight.ClientID );
objInit.Append( "', " );
objInit.Append( "MoveLeftID:'" );
objInit.Append( this.moveLeft.ClientID );
objInit.Append( "', " );
objInit.Append( "MoveAllLeftID:'" );
objInit.Append( this.moveAllLeft.ClientID );
objInit.Append( "', " );
objInit.Append( "MoveUpID:'" );
objInit.Append( this.moveUp.ClientID );
objInit.Append( "', " );
objInit.Append( "MoveDownID:'" );
objInit.Append( this.moveDown.ClientID );
objInit.Append( "' }" );
//script.RegisterArrayDeclaration( "MetaBuilders_DualLists", objInit.ToString() );
ScriptManager.RegisterArrayDeclaration(Page, "MetaBuilders_DualLists", objInit.ToString());
}
}

wrote Feb 14, 2013 at 2:25 AM

wrote May 16, 2013 at 7:48 AM