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

  •  05-26-2005, 2:34 PM

    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

View Complete Thread