下载最新版FreeTextBox(版本3.2.4)
作者网站下载地址:http://freetextbox.com/download/
下载完成后解压
添加 FreeTextBox.DLL 引用到项目
将 ftb.imagegallery.aspx 和aspnet_client文件夹 拷入你的项目当中
在项目根目录中创建Images文件夹用以保存 图片
在使用FTB控件的aspx页面中添加语句:<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
设置<%@ Page ValidateRequest="false"%>
以下是FTB控件代码:
<FTB:FreeTextBox ID="Free1" ImageGalleryPath="~/Images"
Language="zh-CN" runat="server"
ButtonDownImage="True"
toolbarlayout="ParagraphMenu,
FontFacesMenu,
FontSizesMenu,FontForeColorsMenu,
FontForeColorPicker,FontBackColorsMenu,
FontBackColorPicker|Bold,Italic,
Underline,Strikethrough,Superscript,
Subscript,RemoveFormat|JustifyLeft,JustifyRight,
JustifyCenter,JustifyFull;BulletedList,
NumberedList,Indent,Outdent;CreateLink,Unlink,
InsertImage|Cut,Copy,Paste,Delete;
Undo,Redo,Print,Save|SymbolsMenu,StylesMenu,
InsertHtmlMenu|InsertRule,InsertDate,
InsertTime|InsertTable,EditTable;InsertTableRowAfter,
InsertTableRowBefore,DeleteTableRow;
InsertTableColumnAfter,
InsertTableColumnBefore,DeleteTableColumn|InsertForm,
InsertTextBox,InsertTextArea,
InsertRadioButton,
InsertCheckBox,InsertDropDownList,InsertButton|InsertDiv,
EditStyle,InsertImageFromGallery,Preview,SelectAll,
WordClean,NetSpell"
runat="Server"> </FTB:FreeTextBox>
上面代码中 将FreeTextBox中的功能按钮全部显示出来 并使语言为中文 设置上传图片的保存地址
在ftb.imageegallery.aspx 中 设置属性
<FTB:ImageGallery id="ImageGallery1"
SupportFolder="~/aspnet_client/FreeTextBox/"
AllowImageDelete="true" AllowImageUpload="true"
AllowDirectoryCreate="true" AllowDirectoryDelete="true" runat="Server"/>
是否允许删除图片 上传图片 是否允许创建文件夹 删除文件夹
在freetextbox 中 使用了 Imageegallery 上传图片 但是 在界面中是英文的
3) FreeTextBox 属性设置
ImageGalleryPath = "~/image/upload" 上传默认路径
ImageGalleryUrl = "ftb.imagegallery.aspx?rif={0}&cif={0}" ftb.imagegallery.aspx的目录, 只能用相对目录,不可以用"~"
4) ImageGallery 的设置
ftb.imagegallery.aspx文件里
AllowDirectoryCreate - 能否建立文件夹
AllowDirectoryDelete - 能否删除文件夹
AllowImageUpload - 能否上传图片
AllowImageDelete - 能否删除图片
AcceptedFileTypes - 可以上传文件扩展名的数组(array)
<FTB:ImageGallery id="ImageGallery1"
JavaScriptLocation="InternalResource" UtilityImagesLocation="InternalResource"
SupportFolder="~/aspnet_client/FreeTextBox/"
AllowImageDelete=true
AllowImageUpload=true
AllowDirectoryCreate=false
AllowDirectoryDelete=false
runat="Server" />
为开发者提供的2个属性
CurrentDirectories - a string[] array of directories to allow the user to navigate toward
CurrentImages - a FileInfo[] array of files the user should be able to insert.
建议: 删掉Page_Load事件可以显著回避上传图片不能即时显示的问题. 不要重写Page_Load