Editor at AJAX loaded Control

Last post 07-05-2010, 8:04 AM by empty. 1 replies.
Sort Posts: Previous Next
  •  07-05-2010, 3:07 AM 62282

    Editor at AJAX loaded Control

    Hi!
     
    I'm having a problem when i want to load your editor which is placed at a control. This control gets loaded with an AJAX call (using prototype) and the following server code:
     
    1. var output = new StringWriter();   
    2. var pageHolder = new PageHolder();   
    3. UserControl _ctrl = null;   
    4. //some other independet code...   
    5.   
    6. _ctrl = pageHolder.LoadControl("xx/xx/MyControl.ascx",   
    7.                             //ControlConstructor Parameters   
    8.                         );   
    9.   
    10. pageHolder.Controls.Add(_ctrl);   
    11. HttpContext.Current.Server.Execute(pageHolder, output, false);                   
    12.  return new [] {output.ToString()};  
    And javascript consumes this string to render the control into a div.
     
    The problem seems to be a missing function(CuteEditorInitialize) which i could find in the Loader.js in IE_Loader.
    After referencing this file at the page (using a script-tag) it seems to work in IE but not in FireFox.
    FireBug shows the following error: p[OxOe934[46]] is undefined
    Ok this seems to be because im using the IE_Loader...
     
    How ever i think referencing this js file cant be the real solution of this problem.
    Do you have any idea whats going on or how I can fix this problem?
     
    Greetings and thank you,
    empty
     
    edit: the setup of the editor seems to be fine because it is working when i place it directly on a page.
     
  •  07-05-2010, 8:04 AM 62292 in reply to 62282

    Re: Editor at AJAX loaded Control

    It seems the following code can solve the problem...
    But can I be shure that there are no other undiscovered problems?
     
    1. var browserType = Request.Browser.Browser.Equals("IE") ? "IE_Loader" : "Gecko_Loader";   
    2. var jsUrl = string.Format("../CuteSoft_Client/CuteEditor/Scripts/{0}/Loader.js", browserType);   
    3.   
    4. var js = new HtmlGenericControl("script");   
    5. js.Attributes["type"] = "text/javascript";   
    6. js.Attributes["src"] = jsUrl;   
    7. Page.Header.Controls.Add(js);  
    Greetings empty
     
    PS: We support FireFox and IE only.
     
    edit: Code is in Page_Load()
View as RSS news feed in XML