Re: CssClass dropdown automagically populated but stylesheet not applied to edit window

  •  07-11-2008, 6:26 AM

    Re: CssClass dropdown automagically populated but stylesheet not applied to edit window

    I have found a way to make this work:
     
    If I use the path /projectname/css/style.aspx it works so this issue seems to be caused by the tilde(~). From what I see the css attached to the frame has the path ~/blah/blah ... this path should really be expanded to the full path.
     
    Anyhow, I have a way that even lets me import external stylesheets:
    If I scrape the a css url using a local aspx page it is loaded fine and the dropdown is also automagically generated. This also works with dynamic stylesheets.
     
    e.g.
    To load http://cutesoft.net/themes/default/style/Common.css into the Classes Dropdown:
     
    url = "http://cutesoft.net/themes/default/style/Common.css"
    ce.EditorWysiwygModeCss = "/loadpage.aspx?url=" & System.Web.HttpUtility.UrlEncode(url)
     
    Like I say, using ~/loadpage.aspx does not work but using a relative path does.

     
    loadpage.aspx
    <%
    Dim url As String=Request.QueryString.Item("url")
    Dim text As String
    Dim tries As Integer = 2
    For n As Integer=1 to tries
      If len(text)=0 Then text = WebUtils.ReadURL(url)
    Next
    Response.Write(text)
    %>


    WebUtils.vb
    Class WebUtils
      Public Function ReadURL(ByVal url As String) As String
           Try
               Dim wc As New System.Net.WebClient
               Dim s As System.IO.Stream
               Dim sr As System.IO.StreamReader
               Dim text As String

               s = wc.OpenRead(url)

               sr = New System.IO.StreamReader(s)
               text = sr.ReadToEnd()

               sr.Close()
               s.Close()

               Return text
           Catch
               Return Nothing
           End Try
      End Function
    End Class

View Complete Thread