RSS Feed

Editor Control in ASP.NET AJAX

October 20, 2011 by Sourabh Sharma

HTMLEditor is an ASP.NET AJAX Control that allows you to easily create and edit HTML content. Various buttons in toolbar are used for content editing. You can see generated HTML markup and preview document. The Editor control is very useful when you are trying to develop a blogging site. The Editor control has some other features like add image, add videos, change font name, styles, font size, text alignment and many more. In this article I will show you that how to use editor control. Also Fetching values and showing later in another web page in your application.


 


Free Download:
Editor Control : Demo Project

Free Download: Ajax Toolkit 


Source Code Default.Aspx

 <body>

   <form id="form1" runat="server">
 <asp:ScriptManager ID="ScriptManager1" runat="server">
  </asp:ScriptManager> <cc1:Editor ID="Editor1" runat="server" Width="700px" />
 <asp:Button ID="btnSubmit" runat="server" onclick="btnSubmit_Click"
     Text="Submit" />
   </form>
</body>


Default.Aspx.cs Page Code: 

1. btnSubmit_Click() Event:

 protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string str = Editor1.Content;
        Session["info"] = str;
        Response.Redirect("Default2.aspx");
    }

Default2.aspx

Global Variables:

protected string str = “”;

 

Source Code Default.Aspx  

<body> <form id="form1" runat="server">
    <div runat="server">
   <%#str %>
    </div> </form> </body>

 

Default.Aspx.cs Page Code: 

1. Page_Load() Event:

 protected void Page_Load(object sender, EventArgs e)
    {
        str = Session["info"].ToString();
        this.DataBind();
    }

 



No Comments »

No comments yet.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>