Re: AJAX.NET Partial Refresh SOLUTION

  •  07-25-2007, 5:17 PM

    Re: AJAX.NET Partial Refresh SOLUTION

    I don't have time to put together a sample project - the description I submitted should be enough.
    The bug is exactly as described: when loading the editor using an updatepanel async postback, the user-defined "CuteEditor_OnCommand" gets overwritten by the CuteEditor javascript file ("CuteEditorImplementation.js"), which turns it into an empty function.
     
    The workaround is to add this function:
    function onHtmlEditorCommand(editor,command,ui,value)
    {
             //do some custom handling here
    }
    CuteEditor_OnCommand = onHtmlEditorCommand;
    var checkHtmlEditorCommandHandlerInterval = setInterval("checkHtmlEditorCommandHandler()", 500);
    function checkHtmlEditorCommandHandler()
    {
         if(CuteEditor_OnCommand && CuteEditor_OnCommand != onHtmlEditorCommand)
         {
                  CuteEditor_OnCommand = onHtmlEditorCommand;
                  clearInterval(checkHtmlEditorCommandHandlerInterval);
         }
    }

    Now everything works fine - but this is kind of a hack.
     
    As to Object Oriented programming, overriding a global method to handle events is not object oriented. Event handling uses the concept of events and handlers. The MS Ajax implementation is very good and close to C# event handling - you should take a look at it. At least provding a "ClientSideOnCommand" and "ClientSideOnChange" public properties for each editor instance would be a good first step.
     
View Complete Thread