1.添加Bin文件夾。
2.將FreeTextBox.dll放到Bin文件夾
3. 在Web.config裡加入如下代碼
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> <httpHandlers> <add verb="GET" path="FtbWebResource.axd" type="FreeTextBoxControls.AssemblyResourceHandler, FreeTextBox" /> </httpHandlers> <system.web> <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()。
查看本欄目