Change EditorWysiwygModeCss then looses event postback

Last post 01-18-2010, 3:03 AM by Kenneth. 8 replies.
Sort Posts: Previous Next
  •  09-20-2006, 8:00 AM 22848

    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

  •  09-20-2006, 2:58 PM 22867 in reply to 22848

    Re: Change EditorWysiwygModeCss then looses event postback

    AndyFel,
     
    The source code of the above example is as following:
     
    <%@ Page Language="C#" %>
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <script runat="server">
     private void theme_Changed(Object sender, EventArgs e)
     {
      Editor1.EditorWysiwygModeCss  = themeList.SelectedItem.Value; 
      
      Literal1.Text = "Cute Editor automatically parse the CSS classes from EditorWysiwygModeCss <font color=darkred><b>("+themeList.SelectedItem.Value+")</b> </font> and populate all items into CssClass dropdown";
     }

    </script>
    <html>
            <form runat="server">
       <asp:radiobuttonlist id="themeList" runat="server" autopostback="True" RepeatDirection="Horizontal" onselectedindexchanged="theme_Changed">
        <asp:ListItem value="style.css"  Selected="True">style.css</asp:ListItem>
        <asp:ListItem value="backgroundimage.css">backgroundimage.css</asp:ListItem>
        <asp:ListItem value="style.css,backgroundimage.css">style.css+backgroundimage.css</asp:ListItem>
       </asp:radiobuttonlist>
       </p>
       <br>
       <p>            
       <CE:Editor ThemeType="Office2003_BlueTheme" id="Editor1" runat="server" Height="250" AutoConfigure="Simple"></CE:Editor>
       
       <br><br>
       <asp:Literal ID="Literal1" Runat="server" /> 
      </form>
    </html>
     
    Please test it first and modify it to meet your requirments.
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  09-21-2006, 5:43 AM 22897 in reply to 22867

    Re: Change EditorWysiwygModeCss then looses event postback

    Hi
     
    Took the above and tweaked to add the save code too see below (HTML is as yours), and it still misses the event.
    The CSS changes fine, but when I click save after changing the CSS it doesnt work, I have to click it twice.
     
    Have stuck in breakpoints to see when code is being hit and it doesnt even go into the postbackcommand event (does the second time tho).
     
    Any ideas?
    Andy
     
     
      Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
          If Not Page.IsPostBack Then
            'Cute Editor Settings
            Editor1.EditorWysiwygModeCss = "~/styles/AcmsMain.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
            Literal1.Text = "Saved"
          End If
      End Sub
     
      Protected Sub themeList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles themeList.SelectedIndexChanged
        Editor1.EditorWysiwygModeCss = themeList.SelectedItem.Value
        Literal1.Text = ""
      End Sub
     
  •  09-25-2006, 3:43 AM 23020 in reply to 22897

    Re: Change EditorWysiwygModeCss then looses event postback

    Finally solved this one.
     
    I found that I have to change the EditorWysiwygModeCSS in the Editor.Init event (not the page.init as mentioned elsewhere in formum). If I change it here then the other events work as they should.
  •  05-23-2007, 9:21 AM 29972 in reply to 23020

    Re: Change EditorWysiwygModeCss then looses event postback

    Thanks for this post, I had the same problem losing my PostBackCommand when I changed the CSS.  I tried for weeks to get it working!  This should be a very common problem, CuteSoft should post a FAQs about it.
  •  12-15-2009, 1:22 PM 57764 in reply to 29972

    Re: Change EditorWysiwygModeCss then looses event postback

    Thank you so much for this tip.  I have been struggling with this exact situation for several days. 
     
     

    **Edit**

    This actually did not solve my problem.  Yes the page now posts back, but the change in the EditorWysiwygModeClass does not occur until the next post back.  This is because the Editor1_Initializing code occurs before the dropdown_selectedindexedChanged event.  So the Editor1_Initializing code is capturing the previously selected item, not the newly selected item.  So I am always one post back behind.

     

  •  12-15-2009, 10:40 PM 57769 in reply to 22848

    Re: Change EditorWysiwygModeCss then looses event postback

    Hi,
     
    We have found the reason , and will fix this issues in 2 day.
     
    Regards,
    Terry
  •  12-21-2009, 10:32 AM 57864 in reply to 57769

    Re: Change EditorWysiwygModeCss then looses event postback

    Awesome.  Is this fixed?  The date of the most current package in the download folder is 10-09-2009...is there a new version or do you know when the new version will be released?
  •  01-18-2010, 3:03 AM 58223 in reply to 22848

    Re: Change EditorWysiwygModeCss then looses event postback

    Hi AndyFel,
     
    We had fixed this issue in 6.6 version,please download the new version
    download:

    http://www.cutesoft.net/downloads/folders/21904/download.aspx
     
    Regards
     
    Ken

View as RSS news feed in XML