Editor1.Text is not current when postback is called!

Last post 11-08-2006, 12:29 PM by Adam. 8 replies.
Sort Posts: Previous Next
  •  05-26-2005, 9:47 AM 7026

    Editor1.Text is not current when postback is called!

    How can I fix this?
    I've tried adding a text changed postback for cute editor and it is not current either.

  •  05-26-2005, 10:30 AM 7035 in reply to 7026

    Re: Editor1.Text is not current when postback is called!

    It's strange.
     
    Is your site online so you can provide a URL?
     
    Do you have the same problem here?
     
     
     

    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

  •  05-26-2005, 1:53 PM 7053 in reply to 7035

    Re: Editor1.Text is not current when postback is called!

    Hey buddy,
    Thanks for your quick response.  The issue had to do with adding controls to the tool bar.  I'm trying a different approach and expect/hope the issue with Editor1.Text will go away... I want to call this form Page_Load - but can't figure out how to assign a call back for a custom pull down... see below

            public void AddControls()
            {
                CuteEditor.RichListItem ddi = new CuteEditor.RichListItem("edit");

                ddi.Click+=new EventHandler(Edit_Click);  //Error:  How do I do this?

                CuteEditor.RichDropDownList dd = new CuteEditor.RichDropDownList(Editor1);
                dd.Items.Add(ddi);
                dd.CssClass="CuteEditorDropDown";
       
                CuteEditor.ToolControl ctrl = new CuteEditor.ToolControl("WhatsThisNameFor?",dd);
            }



  •  05-26-2005, 2:34 PM 7056 in reply to 7053

    Re: Editor1.Text is not current when postback is called!

    This is an example:
     
    protected CuteEditor.Editor Editor1;
      protected System.Web.UI.WebControls.Label Label1;
      private void Page_Load(object sender, System.EventArgs e)
      {
       // Put user code to initialize the page here
      }
      #region Web Form Designer generated code
      override protected void OnInit(EventArgs e)
      {
       //
       // CODEGEN: This call is required by the ASP.NET Web Form Designer.
       //
       InitializeComponent();
       base.OnInit(e);
      }
      
      /// <summary>
      /// Required method for Designer support - do not modify
      /// the contents of this method with the code editor.
      /// </summary>
      private void InitializeComponent()
      {   
       this.Editor1.PostBackCommand += new System.Web.UI.WebControls.CommandEventHandler(this.Editor1_PostBackCommand);
       this.Editor1.TextChanged += new System.EventHandler(this.Editor1_TextChanged);
       this.Editor1.Initializing += new System.EventHandler(this.Editor1_Initializing);
       this.Load += new System.EventHandler(this.Page_Load);
      }
      #endregion
      private void Editor1_Initializing(object sender, System.EventArgs e)
      {
       //the controls could only register before the CuteEditor Initialized
       Button hello=new Button();
       hello.Text="Hello";
       hello.Style["vertical-align"]="middle";
       hello.CommandName="Hello";
       hello.Click+=new EventHandler(hello_Click);
       Button world=new Button();
       world.Text="World";
       world.Style["vertical-align"]="middle";
       world.CommandName="World";
       world.Click+=new EventHandler(world_Click);
       Editor1.RegisterCustomButton("hello",hello);
       Editor1.RegisterCustomButton("world",world);
      }
      private void Editor1_PostBackCommand(object sender, System.Web.UI.WebControls.CommandEventArgs e)
      {
       Label1.Text="You just click the button : "+e.CommandName;
      }
      private void hello_Click(object sender, EventArgs e)
      {
       Editor1.Text+="<div style='color:red'>Hello Clicked</div>";
      }
      private void world_Click(object sender, EventArgs e)
      {
       Editor1.Text+="<div style='color:red'>World Clicked</div>";
      }
      private void Editor1_TextChanged(object sender, System.EventArgs e)
      {
      
      }
     
    You can find the source code of this example in the download package.
     
     

    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

  •  11-07-2005, 3:04 PM 12334 in reply to 7056

    Re: Editor1.Text is not current when postback is called!

    The problem still remains.  It's very significant since it means that one cannot use javascript to confirm whether the cuteeditor txt fields have non-empty values. 

    When the user hits the submit button, first we run a javascript validator against the page.  The postback is only called if the values in the cuteeditor text boxes are correct and non-empty.

    How can we get the correct value from the cuteeditor text field PRIOR to a postback occurring?

    Thanks,
    Liz
  •  11-08-2005, 4:42 AM 12358 in reply to 12334

    Re: Editor1.Text is not current when postback is called!

    Liz,
     
    >>It's very significant since it means that one cannot use javascript to confirm whether the cuteeditor txt fields have non-empty values.
    You can use the following code to get the content of the editor and check the content before the form is submitted:


        // get the cute editor instance
        var editor1 = document.getElementById('<%=Editor1.ClientID%>');
        
        // Get the editor HTML
        alert(editor1.getHTML());
     
     

    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

  •  11-08-2005, 10:01 AM 12387 in reply to 12358

    Re: Editor1.Text is not current when postback is called!

    Thank you, Adam!  Works great!
  •  11-08-2006, 11:52 AM 24145 in reply to 7035

    Re: Editor1.Text is not current when postback is called!

    Adam:
    It's strange.
     
    Is your site online so you can provide a URL?
     
    Do you have the same problem here?
     
     
     
     
    if i have:
     
    _myInstanceVar = Editor1.Text
     
    on server side after a button click event, shouldn't this give me the most current content?
  •  11-08-2006, 12:29 PM 24147 in reply to 24145

    Re: Editor1.Text is not current when postback is called!

    >>if i have: _myInstanceVar = Editor1.Text
     
    on server side after a button click event, shouldn't this give me the most current content?
     
    Yes. It should give you the most current content.
     

    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

View as RSS news feed in XML