Change EditorWysiwygModeCss then looses event postback

  •  09-20-2006, 8:00 AM

    Change EditorWysiwygModeCss then looses event postback

    Hi
     
    I am allowing the user to select the CSS file. This bit is fine, i can select the file and the css class combo changes. No Probs.
     
    However what I am finding is that if I try and save after changing the css file then it doesnt work. But when i click it a second time then it does work fine! It seems for some reason the event handling code is not firing.
     
    E.g.
    Click save - does a postback and saves
    Change Css - does a postback and changes css
    Click save - does a postback and returns but no save!
    Click save - does a postback and saves
     
    Code is pasted below. Any ideas? I tried placing the code to change the Css in the page_init but then it doesnt  change css.
     

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    If Page.IsPostBack Then

    If Request.Form(hdnTemplateChanged.UniqueID) = "ReloadCSS" Then

    Editor1.EditorWysiwygModeCss = "~/styles/calendarstyles.css"

    End If

    hdnTemplateChanged.Value = ""

    End If

    If Not Page.IsPostBack Then

    Editor1.EditorWysiwygModeCss = "~/styles/cmsMain.css"

    End If

    End Sub

    Protected Sub Editor1_PostBackCommand(ByVal Sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs) Handles Editor1.PostBackCommand

    If String.Compare(e.CommandName, "Save", True) = 0 Then

    lblError.Text = "Saved"

    End If

    End Sub

View Complete Thread