| 396 | protected override void OnPreRender( EventArgs e ) |
| 397 | { |
| 398 | base.OnPreRender( e ); |
| 399 | |
| 400 | _IsCompatible = this.CheckBrowserCompatibility(); |
| 401 | |
| 402 | if ( !_IsCompatible ) |
| 403 | return; |
| 404 | |
| 405 | object oScriptManager = null; |
| 406 | |
| 407 | // Search for the ScriptManager control in the page. |
| 408 | Control oParent = this.Parent; |
| 409 | while ( oParent != null ) |
| 410 | { |
| 411 | foreach ( object control in oParent.Controls ) |
| 412 | { |
| 413 | // Match by type name. |
| 414 | if ( control.GetType().FullName == "System.Web.UI.ScriptManager" ) |
| 415 | { |
| 416 | oScriptManager = control; |
| 417 | break; |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | if ( oScriptManager != null ) |
| 422 | break; |
| 423 | |
| 424 | oParent = oParent.Parent; |
| 425 | } |
| 426 | |
| 427 | // If the ScriptManager control is available. |
| 428 | if ( oScriptManager != null ) |
| 429 | { |
| 430 | try |
| 431 | { |
| 432 | // Use reflection to check the SupportsPartialRendering |
| 433 | // property value. |
| 434 | bool bSupportsPartialRendering = ((bool)(oScriptManager.GetType().GetProperty( "SupportsPartialRendering" ).GetValue( oScriptManager, null ))); |
| 435 | |
| 436 | if ( bSupportsPartialRendering ) |
| 437 | { |
| 438 | string sScript = "(function()\n{\n" + |
| 439 | "\tvar editor = FCKeditorAPI.GetInstance('" + this.ClientID + "');\n" + |
| 440 | "\tif (editor)\n" + |
| 441 | "\t\teditor.UpdateLinkedField();\n" + |
| 442 | "})();\n"; |
| 443 | |
| 444 | // Call the RegisterOnSubmitStatement method through |
| 445 | // reflection. |
| 446 | oScriptManager.GetType().GetMethod( "RegisterOnSubmitStatement", new Type[] { typeof( Control ), typeof( Type ), typeof( String ), typeof( String ) } ).Invoke( oScriptManager, new object[] { |
| 447 | this, |
| 448 | this.GetType(), |
| 449 | "FCKeditorAjaxOnSubmit_" + this.ClientID, |
| 450 | sScript } ); |
| 451 | |
| 452 | // Tell the editor that we are handling the submit. |
| 453 | this.Config[ "PreventSubmitHandler" ] = "true"; |
| 454 | } |
| 455 | } |
| 456 | catch { } |
| 457 | } |
| 458 | } |
| 459 | |