Re: AJAX.NET Partial Refresh SOLUTION

  •  07-09-2007, 7:07 AM

    Re: AJAX.NET Partial Refresh SOLUTION

    SOLUTION
     
    Place the following code in your Page.  (DEMO : http://cutesoft.paperheads.co.uk/)
     
    Internet Explorer works perfectly, however FireFox and Opera have a slight issue (please see below). Safari also works well, provided you supply the correct CSS to the header on the page load.
     
    This code forces the required JS files to be downloaded on the page's load, even if CE is not visible. Not ideal, it would be better to use ScriptManager as per my post above (so the JS is only downloaded if nessessary), but this works.
     
    Private Sub MyBase_PreRender(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.PreRender
      Dim sBrowserString As String 
      Select Case Page.Request.Browser.Browser
       
    Case "IE", "Opera"
         
    sBrowserString = Page.Request.Browser.Browser
        Case "AppleMAC-Safari", "Safari"
          sBrowserString = "Safari"
          'Also need to add link to Safari CSS file
       
    Case Else
         
    sBrowserString = "Gecko"
      
    End Select 

      
    Dim sScriptUrl As String = String.Format("~/CuteSoft_Client/CuteEditor/Load.ashx?type=scripts&file={0}_Loader", sBrowserString)
      Page.ClientScript.RegisterClientScriptInclude(GetType(CuteEditor.Editor),
    "CuteSoft.AJAX", Page.ResolveUrl(sScriptUrl))
    End Sub
     
    Adam,
     
    In FireFox and Opera I get the following JavaScript error when posting back using a LinkButton (or anything that uses __doPostBack) on the the post after CE has first been dispayed. This prevents the page from posting back.
     
    editor.GetScriptProperty is not a function
     
    I assume this is because you are holding a reference to each CE after it has been initialised, but at this point the object has been disposed. If you could alter your javascript to do a quick check to see if the editor exists we can solve this once and for all.
     
    Thanks,
    Ady
     

View Complete Thread