.net 3.5(C#) 中 FTB(FreeTextBox)控件的使用

这篇博客介绍了如何在.NET 3.5 C#项目中使用FreeTextBox 3.2.4控件,包括下载控件、添加引用、设置图片上传路径,以及配置ImageGallery的属性,如允许删除、上传图片和创建文件夹等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

下载最新版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



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值