ASP.NET - How we Ajax Html Editor - Asked By ALOK RANJAN on 10-Oct-11 03:25 AM

Which Namespace we add by using    AJAX HTML EDITOR
Reena Jain replied to ALOK RANJAN on 10-Oct-11 03:30 AM
HI,

Before you can use the HTML Editor in an ASP.NET page, you must first add a ScriptManager control to the page. The ScriptManager control is located beneath the AJAX Extensions tab in the Visual Studio/Visual Web Developer Express toolbox.

You should place the ScriptManager control at the top of the page before any other controls on the page. For example, you can place it immediately below the opening server-side <form> tag.


<%@ Page Language="C#" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit.HTMLEditor" tagprefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<script runat="server">
 
  protected void btnSubmit_Click(object sender, EventArgs e)
  {
    ltlResult.Text = Editor1.Content;
  }
</script>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
  <title></title>
</head>
<body>
  <form id="form1" runat="server">
  <div>
      
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
     
    <cc1:Editor
      ID="Editor1"
      Width="450px" 
      Height="200px"
      runat="server"/>
    <br />
    <asp:Button
      id="btnSubmit"
      Text="Submit"
      Runat="server" onclick="btnSubmit_Click" />
   
    <hr />
    <h1>You Entered:</h1>
     
    <asp:Literal
      id="ltlResult"
      Runat="server" />
   
  </div>
  </form>
</body>
</html>

for more check this
http://www.asp.net/ajaxlibrary/ajaxcontroltoolkitsamplesite/htmleditor/htmleditor.aspx
dipa ahuja replied to ALOK RANJAN on 10-Oct-11 03:32 AM
Untitled document
Make sure you have added the dll and the ajax registration in Bin directory and the web.config file :
 
1. Add the ajaxtoolkit.dll in the BIN directory of your website
 
2. Add  this in the web.config inside Controls node:
<controls>
<add tagPrefix="cc1" namespace="System.Web.UI"
assembly="System.Web.Extensions, Version=1.0.61025.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35"/>
<add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="cc1"/>
</controls>

 You don't need to add any namespace in code behind. you can access the editor control from the codebehind same way as we access the sever control
Anoop S replied to ALOK RANJAN on 10-Oct-11 03:32 AM
added both System.Web.Ajax.dll and AjaxControlToolkit.dll from the webforms/debug folder to my [ASP.NET web app] project.

and make sure you add the namespace

using AjaxControlToolkit.HTMLEditor;
Jitendra Faye replied to ALOK RANJAN on 10-Oct-11 04:09 AM
After adding AjaxControlToolKit dll to your project you can Use Ajax Editor like this-

http://i1.asp.net/asp.net/images/ajax-control-toolkit/49/CS/image005.png


<%@ Register
    Assembly="AjaxControlToolkit"
    Namespace="AjaxControlToolkit.HTMLEditor"
    TagPrefix="HTMLEditor" %>
...
<HTMLEditor:Editor runat="server" 
        Height="300px" 
        Width="100%"
        AutoFocus="true"
/>

For more help about this control follow this good links-
http://www.asp.net/ajaxlibrary/ajaxcontroltoolkitsamplesite/htmleditor/htmleditor.aspx
http://www.asp.net/ajax/tutorials/how-do-i-use-the-html-editor-control-cs

Try this and let me know.
Hope this will help you.