| | 396 | protected override void OnLoad( EventArgs e ) |
| | 397 | { |
| | 398 | base.OnLoad( 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() {" + |
| | 439 | "var editor = FCKeditorAPI.GetInstance('" + this.ClientID + "');" + |
| | 440 | "if (editor) editor.UpdateLinkedField();" + |
| | 441 | "})();"; |
| | 442 | |
| | 443 | // Call the RegisterOnSubmitStatement method through |
| | 444 | // reflection. |
| | 445 | oScriptManager.GetType().GetMethod( "RegisterOnSubmitStatement", new Type[] { typeof( Control ), typeof( Type ), typeof( String ), typeof( String ) } ).Invoke( oScriptManager, new object[] { |
| | 446 | this, |
| | 447 | this.GetType(), |
| | 448 | "FCKeditorAjaxOnSubmit_" + this.ClientID, |
| | 449 | sScript } ); |
| | 450 | |
| | 451 | // Tell the editor that we are handling the submit. |
| | 452 | this.Config[ "PreventSubmitHandler" ] = "true"; |
| | 453 | } |
| | 454 | } |
| | 455 | catch { } |
| | 456 | } |
| | 457 | } |
| | 458 | |