| 57 | static FCKeditor() |
| 58 | { |
| 59 | Type scriptManagerType = Type.GetType( "System.Web.UI.ScriptManager, System.Web.Extensions" ) ; |
| 60 | if ( scriptManagerType != null ) |
| 61 | { |
| 62 | getCurrentScriptManagerMethod = scriptManagerType.GetMethod( "GetCurrent", new Type[] { typeof( Page ) } ) ; |
| 63 | supportsPartialRenderingProperty = scriptManagerType.GetProperty( "SupportsPartialRendering" ) ; |
| 64 | registerOnSubmitStatementMethod = scriptManagerType.GetMethod( "RegisterOnSubmitStatement", new Type[] { typeof( Control ), typeof( Type ), typeof( String ), typeof( String ) } ) ; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | private bool _IsCompatible ; |
| 69 | |
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 | | |
432 | | // Use reflection to check the SupportsPartialRendering |
433 | | // property value. |
434 | | bool bSupportsPartialRendering = ((bool)(oScriptManager.GetType().GetProperty( "SupportsPartialRendering" ).GetValue( oScriptManager, null ))); |
| 437 | string sScript = String.Format( onSubmitScriptTemplate, this.ClientID ); |
| 438 | |
| 439 | // Call the RegisterOnSubmitStatement method through |
| 440 | // reflection. |
| 441 | registerOnSubmitStatementMethod.Invoke( oScriptManager, new object[] { |
| 442 | this, |
| 443 | this.GetType(), |
| 444 | "FCKeditorAjaxOnSubmit_" + this.ClientID, |
| 445 | sScript } ); |
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 | | } |
| 447 | // Tell the editor that we are handling the submit. |
| 448 | this.Config[ "PreventSubmitHandler" ] = "true"; |