1.下載下傳 FreeTextBox
http://freetextbox.com/download/
2. 安裝
FreeTextBox 3.0以上版本均支援内部模式,即圖檔資源和javascript都內建在dll中, 本文僅探讨内部模式(Internal Resources).
1) 把FTBv3-1-1/Framework-1.1/FreetextBox.dll拷入bin目錄.
2) 在項目中添加FreetextBox.dll的dll引用
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>
3. 使用FreeTextBox
1) aspx頁面頂上
<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox"%>
2) 調用
<FTB:FreeTextBox ID="FreeTextBox1" runat="Server" ToolbarLayout="ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu,FontBackColorsMenu,SymbolsMenu|InsertRule,InsertDate,InsertTime,InsertImageFromGallery,InsertTable|SelectAll,Cut,Copy,Find,Paste,Delete;Undo,Redo,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent|Bold,Italic,Underline,Strikethrough,Superscript,Subscript;CreateLink,Unlink"
Width="700" Language="zh-CN" ToolbarStyleConfiguration="Office2003" ToolbarBackgroundImage="true"
ImageGalleryPath="~/image/upload" ImageGalleryUrl="ftb.imagegallery.aspx?rif={0}&cif={0}"
StartMode="DesignMode">
3)工具欄皮膚
ToolbarStyleConfiguration = Offoce2003/OfficeXP/Office2000/MAC
4) 用戶端中檢測到有潛在危險的 Request.Form 值
<%@ Page language="c#"

ValidateRequest="false"%>
4 圖檔上傳
1) 工具欄上添加ImageGallery按鈕.
<FTB:FreeTextBox ..ToolbarLayout=" ..,InsertImageFromGallery,.. />
2) 拷貝 "ftb.imagegallery.aspx" 檔案到同一目錄下,即和你目前頁面在同一目錄。
3) FreeTextBox 屬性設定
Language="zh-CN" 中文
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)
為開發者提供的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