I've got a page with a modalpopup (asp.net) within an updatepanel - the modalpopup panel includes an fckEditor control.
I've downloaded the new .net version which fixes updatepanel issues but this only works with the standard scriptmanager and not the ToolkitScriptManager.
The problem code is in the onPreRender function:
I've added a line to check for the ToolkitScriptManager as well as the standard scriptmanager but it then falls over on the RegisterOnSubmit call (object is null??)
... this is driving me up the wall as my whole page unravels if I cant' have this working inside the popup .. since ToolkitScriptManager inherits from the base ScriptManager I can't see what is wrong here! .... any help or ideas greatly appreciated!
while ( oParent != null )
{
foreach ( object control in oParent.Controls )
{
// Match by type name.
if ( control.GetType().FullName == "System.Web.UI.ScriptManager" ||
control.GetType().FullName == "AjaxControlToolkit.ToolkitScriptManager")
{
oScriptManager = control;
break;
}
}
if ( oScriptManager != null )
break;
oParent = oParent.Parent;
}
// If the ScriptManager control is available.
if ( oScriptManager != null )
{
try
{
// Use reflection to check the SupportsPartialRendering
// property value.
bool bSupportsPartialRendering = ((bool)(oScriptManager.GetType().GetProperty( "SupportsPartialRendering" ).GetValue( oScriptManager, null )));
if ( bSupportsPartialRendering )
{
string sScript = "(function()\n{\n" +
"\tvar editor = FCKeditorAPI.GetInstance('" + this.ClientID + "');\n" +
"\tif (editor)\n" +
"\t\teditor.UpdateLinkedField();\n" +
"})();\n";
// Call the RegisterOnSubmitStatement method through
// reflection.
oScriptManager.GetType().GetMethod( "RegisterOnSubmitStatement", new Type[] { typeof( Control ), typeof( Type ), typeof( String ), typeof( String ) } ).Invoke( oScriptManager, new object[] {
this,
this.GetType(),
"FCKeditorAjaxOnSubmit_" + this.ClientID,
sScript } );
// Tell the editor that we are handling the submit.
this.Config[ "PreventSubmitHandler" ] = "true";
}
}
catch { }
}
I've downloaded the new .net version which fixes updatepanel issues but this only works with the standard scriptmanager and not the ToolkitScriptManager.
The problem code is in the onPreRender function:
I've added a line to check for the ToolkitScriptManager as well as the standard scriptmanager but it then falls over on the RegisterOnSubmit call (object is null??)
... this is driving me up the wall as my whole page unravels if I cant' have this working inside the popup .. since ToolkitScriptManager inherits from the base ScriptManager I can't see what is wrong here! .... any help or ideas greatly appreciated!
while ( oParent != null )
{
foreach ( object control in oParent.Controls )
{
// Match by type name.
if ( control.GetType().FullName == "System.Web.UI.ScriptManager" ||
control.GetType().FullName == "AjaxControlToolkit.ToolkitScriptManager")
{
oScriptManager = control;
break;
}
}
if ( oScriptManager != null )
break;
oParent = oParent.Parent;
}
// If the ScriptManager control is available.
if ( oScriptManager != null )
{
try
{
// Use reflection to check the SupportsPartialRendering
// property value.
bool bSupportsPartialRendering = ((bool)(oScriptManager.GetType().GetProperty( "SupportsPartialRendering" ).GetValue( oScriptManager, null )));
if ( bSupportsPartialRendering )
{
string sScript = "(function()\n{\n" +
"\tvar editor = FCKeditorAPI.GetInstance('" + this.ClientID + "');\n" +
"\tif (editor)\n" +
"\t\teditor.UpdateLinkedField();\n" +
"})();\n";
// Call the RegisterOnSubmitStatement method through
// reflection.
oScriptManager.GetType().GetMethod( "RegisterOnSubmitStatement", new Type[] { typeof( Control ), typeof( Type ), typeof( String ), typeof( String ) } ).Invoke( oScriptManager, new object[] {
this,
this.GetType(),
"FCKeditorAjaxOnSubmit_" + this.ClientID,
sScript } );
// Tell the editor that we are handling the submit.
this.Config[ "PreventSubmitHandler" ] = "true";
}
}
catch { }
}