1.添加Bin文件夹。
2.将FreeTextBox.dll放到Bin文件夹
3. 在Web.config里加入如下代码
1 <?xml version="1.0" encoding="utf-8" ?> 2 <configuration> 3 <system.web> 4 <httpHandlers> 5 <add verb="GET" path="FtbWebResource.axd" type="FreeTextBoxControls.AssemblyResourceHandler, FreeTextBox" /> 6 </httpHandlers> 7 <system.web> 8 <configuration>
4.在使用页面顶部添加
<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
5.调用FreeTextBox
<FTB:FreeTextBox id="FreeTextBox1" runat="Server" />
6.FreeTextBox配置
1)工具栏皮肤
ToolbarStyleConfiguration = Offoce2003/OfficeXP/Office2000/MAC
2)得到保存编辑的内容//木有用到
private voidInitializeComponent() { // 指向同一个委托 this.FreeTextBox1.SaveClick += new System.EventHandler (athis.FreeTextBox1_SaveClick); this.Button1.Click += new System.EventHandler(this.FreeTextBox1_SaveClick); } private void FreeTextBox1_SaveClick(objectsender, System.EventArgs e) { divshow.InnerHtml =FreeTextBox1.Text; }
3)客户端中检测有危险值
<%@ Page language="c#" ValidateRequest="false"%>
4)工具栏设置
ToolbarLayout属性值:
ParagraphMenu, FontFacesMenu, FontSizesMenu, FontForeColorsMenu, FontForeColorPicker, FontBackColorsMenu, FontBackColorPicker, Bold, Italic, Underline, Strikethrough, Superscript, Subscript, InsertImageFromGallery, CreateLink, Unlink, RemoveFormat, JustifyLeft, JustifyRight, JustifyCenter, JustifyFull, BulletedList, NumberedList, Indent, Outdent, Cut, Copy, Paste, Delete, Undo, Redo, Print, Save, ieSpellCheck, StyleMenu, SymbolsMenu, InsertHtmlMenu, InsertRule, InsertDate, InsertTime, WordClean, InsertImage, InsertTable, EditTable, InsertTableRowBefore, InsertTableRowAfter, DeleteTableRow, InsertTableColumnBefore, InsertTableColumnAfter, DeleteTableColumn, InsertForm, InsertForm, InsertTextBox, InsertTextArea, InsertRadioButton, InsertCheckBox, InsertDropDownList, InsertButton, InsertDiv, InsertImageFromGallery, Preview, SelectAll, EditStyle
这么多种按钮,中间用可以用","(逗号)";"(分号)"|"(管道符)隔开。
7.图片上传设置
1) 工具栏上添加ImageGallery按钮.
<FTB:FreeTextBox ..ToolbarLayout=" ..,InsertImageFromGallery,.. />
2) 拷贝 "ftb.imagegallery.aspx" 文件和aspnet_client文件夹(为毛木人告诉我?)到同一目录下
http://wiki.freetextbox.com/default.aspx/FreeTextBoxWiki.ImageGallery
图片默认是上传在根目录的images文件夹里面的,所以要建一个文件夹。图片上传的原大小,调用时可设置显示大小。
3) FreeTextBox 属性设置
ImageGalleryPath = "~/image/upload" 上传默认路径
ImageGalleryUrl = "ftb.imagegallery.aspx?rif={0}&cif={0}" ftb.imagegallery.aspx的目录, 只能用相对目录,不可以用"~"
4) ImageGallery 的设置//文件里有这段代码
ftb.imagegallery.aspx文件里
<FTB:ImageGallery id="ImageGallery1" JavaScriptLocation="InternalResource" UtilityImagesLocation="InternalResource" SupportFolder="~/aspnet_client/FreeTextBox/" AllowImageDelete=true AllowImageUpload=true AllowDirectoryCreate=false AllowDirectoryDelete=false runat="Server" />
AllowDirectoryCreate - 能否建立文件夹
AllowDirectoryDelete - 能否删除文件夹
AllowImageUpload - 能否上传图片
AllowImageDelete - 能否删除图片
AcceptedFileTypes - 可以上传文件扩展名的数组(array)
5) ftb.imagegallery.aspx页面关闭//可选
打开 aspnet_client\FreeTextBox\FTB-ImageGallery.js 文件,在FTB_InsertImage函数的最后加上window.close()。