Ajax的使用HTMLEditor旧版本,使用起来还算可以。在使用时,需要在页面注册:
<%
@ Register Assembly
=
"
AjaxControlToolkit
"
Namespace
=
"
AjaxControlToolkit.HTMLEditor
"
TagPrefix = " HTMLEditor " %>
TagPrefix = " HTMLEditor " %>
如果多页同时使用,可以在Web.config配置,这样不必在每个页面都写上,如下:
View Code
<
system.web
>
< pages controlRenderingCompatibilityVersion ="3.5" clientIDMode ="AutoID" >
< controls >
< add namespace ="AjaxControlToolkit" assembly ="AjaxControlToolkit" tagPrefix ="ajaxToolkit" />
</ controls >
</ pages >
</ system.web >
< pages controlRenderingCompatibilityVersion ="3.5" clientIDMode ="AutoID" >
< controls >
< add namespace ="AjaxControlToolkit" assembly ="AjaxControlToolkit" tagPrefix ="ajaxToolkit" />
</ controls >
</ pages >
</ system.web >
如果你的HtmlEditor应用在GridView时,怎样取值?可参考:
View Code
<
EditItemTemplate
>
< HTMLEditor:Editor ID ="heDescription" runat ="server" Height ="200px" AutoFocus ="true"
Content ='<%# Eval("Description") % > ' Width="100%" />
</ EditItemTemplate >
< HTMLEditor:Editor ID ="heDescription" runat ="server" Height ="200px" AutoFocus ="true"
Content ='<%# Eval("Description") % > ' Width="100%" />
</ EditItemTemplate >
取值:
string
description
=
((AjaxControlToolkit.HTMLEditor.Editor)gvr.FindControl(
"
heDescription
"
)).Content;
昨天,前去Ajax网站,发现有新版本。相关可以点击下链接:http://ajaxcontroltoolkit.codeplex.com/,它已经不是单独一个控件,而是一个Extender控件,TargetControl是一个TextBox控件,另一个还要说的是,Toolbar可以增减,如:
上图片代码:
View Code
<
asp:TextBox
ID
="txtDescription"
TextMode
="MultiLine"
Columns
="70"
Rows
="6"
runat
="server"
/>
< br />
< ajaxToolkit:HtmlEditorExtender ID ="HtmlEditorExtender1" runat ="server" TargetControlID ="txtDescription" >
< Toolbar >
< ajaxToolkit:Bold />
< ajaxToolkit:Italic />
< ajaxToolkit:Underline />
< ajaxToolkit:JustifyLeft />
< ajaxToolkit:JustifyCenter />
< ajaxToolkit:JustifyRight />
< ajaxToolkit:JustifyFull />
< ajaxToolkit:CreateLink />
< ajaxToolkit:UnLink />
</ Toolbar >
</ ajaxToolkit:HtmlEditorExtender >
< br />
< ajaxToolkit:HtmlEditorExtender ID ="HtmlEditorExtender1" runat ="server" TargetControlID ="txtDescription" >
< Toolbar >
< ajaxToolkit:Bold />
< ajaxToolkit:Italic />
< ajaxToolkit:Underline />
< ajaxToolkit:JustifyLeft />
< ajaxToolkit:JustifyCenter />
< ajaxToolkit:JustifyRight />
< ajaxToolkit:JustifyFull />
< ajaxToolkit:CreateLink />
< ajaxToolkit:UnLink />
</ Toolbar >
</ ajaxToolkit:HtmlEditorExtender >