到 www.freetextbox.com網站上,裡面有個 Download Control (3.1.6) (zip)
-
點選就可以了,下完以後是個壓縮檔案,解壓開來,有這幾個主要檔案:
aspnet_client FreeTextBox的外觀檔案,直接拷貝到你的工程的目錄下就可以了。
Docs 文檔嘛,就是說明文檔,隻有一個幫助檔案
examples 這是人家官方調試好的例子
Framework-2.0 适合.net freameork2.0使用的dll(命名空間)
Framework-1.1 适合.net freameork1.1使用的dll(命名空間)
Framework-1.0 适合.net freameork1.0使用的dll(命名空間)
隻要把Framework-2.0/Framework-1.1/Framework-1.0三個中适合你用的那個dll拷貝到你工程下的bin目錄下,将
aspnet_client 拷貝到工程目錄下,然後你可以随便的調試任何一個例子都很容易通過的。
這是一個例子:
Default.aspx
<% @ Page Language = " C# " AutoEventWireup = " true " CodeFile = " Default.aspx.cs " Inherits = " _Default " ValidateRequest = " false " %>
<% @ Register TagPrefix = " FTB " Namespace = " FreeTextBoxControls " Assembly = " FreeTextBox " %>
<% @ Register TagPrefix = " FCKeditorV2 " Namespace = " FredCK.FCKeditorV2 " Assembly = " FredCK.FCKeditorV2 " %>
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< script runat ="server" >
</ script >
< html xmlns ="http://www.w3.org/1999/xhtml" >
< head runat ="server" >
< title > 無标題頁 </ title >
</ head >
< body >
< form id ="Form1" runat ="server" >
< h2 > Languages and Buttons </ h2 >
< div >
< asp:dropdownlist ID ="ToolbarStyle" Runat ="Server" />
< asp:dropdownlist ID ="Language" Runat ="Server" />
< asp:Button ID ="ConfigureButton" Text ="Configure" runat ="Server" OnClick ="ConfigureButton_Click" />
< br />
< FTB:FreeTextBox id ="FreeTextBox1"
Focus ="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"
ImageGalleryPath = "~/image/upload"
ImageGalleryUrl = "ftb.imagegallery.aspx?rif={0}&cif={0}"
Language ="zh-CN"
ToolbarStyleConfiguration ="Office2003"
OnSaveClick ="SaveButton_Click"
runat ="Server" >
</ FTB:FreeTextBox >
< asp:LinkButton ID ="LinkButton1" runat ="server" />
< asp:Button id ="SaveButton" Text ="Save" runat ="server" OnClick ="SaveButton_Click" />
</ div >
< div >
< asp:Literal id ="Output" runat ="server" />
</ div >
</ form >
</ body >
</ html >
其中要注意的是,由于ASP.NET不是預設會自動産生_doPostBack方法,是以,如果采用FTB的預設Save按鈕操作,可能會報告對象不存在錯誤,是以,可以在網頁中添加一行<asp:LinkButton ID="LinkButton1" runat="server"/>來強制要求産生_doPostBack方法。Language屬性設定要求放置在toolbarlayout之後設定,否則可能産生不了效果。
Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Specialized;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load( object sender, EventArgs e)
{
ToolbarStyle.DataSource = Enum.GetNames( typeof (FreeTextBoxControls.ToolbarStyleConfiguration));
if ( ! IsPostBack)
{
FreeTextBox1.FontFacesMenuList = new string[] { "Arial", "Courier New", "Garamond", "Georgia", "Tahoma", "Times New Roman", "/"楷體_GB2312/"", "/"宋體/"", "/"黑體/"", "/"仿宋_gb2312/"", "/"隸書/"" };
FreeTextBox1.FontFacesMenuNames = new string[] { "Arial", "Courier New", "Garamond", "Georgia", "Tahoma", "Times New Roman", "楷體", "宋體", "黑體", "仿宋", "隸書"}; ToolbarStyle.DataSource = Enum.GetNames( typeof (FreeTextBoxControls.ToolbarStyleConfiguration));
ToolbarStyle.DataBind();
FreeTextBoxControls.Support.ResourceManager rm = new FreeTextBoxControls.Support.ResourceManager();
NameValueCollection languages = rm.GetSupportedLanguages();
foreach ( string key in languages)
{
Language.Items.Add( new ListItem(key, languages[key]));
}
FreeTextBox1.Text = " <p>some <b>Bold</b> and <u>underlined</u> and <font color="#008000">colored</font> text<p><ul><li>bulleted list 1</li></ul> " ;
}
}
protected void ConfigureButton_Click( object sender, EventArgs e)
{
FreeTextBox1.ToolbarStyleConfiguration = (FreeTextBoxControls.ToolbarStyleConfiguration)Enum.Parse( typeof (FreeTextBoxControls.ToolbarStyleConfiguration), ToolbarStyle.SelectedValue);
FreeTextBox1.Language = Language.SelectedValue;
}
protected void SaveButton_Click( object sender, EventArgs e)
{
Output.Text = FreeTextBox1.Text;
}
}
ImageGallery的使用
将壓縮包中的ftb.imagegallery.aspx拷貝到工程目錄下,然後修改該檔案以配置相應的圖檔上傳屬性。
<% @ Page Language = " C# " ValidateRequest = " false " Trace = " false " %>
<% @ Register TagPrefix = " FTB " Namespace = " FreeTextBoxControls " Assembly = " FreeTextBox " %>
< html xmlns ="http://www.w3.org/1999/xhtml" >
< head >
< title > Image Gallery </ title >
</ head >
< body >
< form id ="Form1" runat ="server" enctype ="multipart/form-data" >
< FTB:ImageGallery id ="ImageGallery1"
JavaScriptLocation ="InternalResource"
UtilityImagesLocation ="InternalResource"
SupportFolder ="~/aspnet_client/FreeTextBox/"
AllowImageDelete ="true"
AllowImageUpload ="true"
AllowDirectoryCreate ="false"
AllowDirectoryDelete ="false"
runat ="Server" />
</ form >
</ body >
</ html >