惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - xujh

C# 同步两个子目录文件 ASP.NET中突破上传4M文件的限制 【转】一种在SQLServer中实现Sequence的高效方法 DevExpress的ASPxGridView中实现Master-Detail数据动态绑定 【转】浅谈:国内软件公司为何无法做大做强? - xujh - 博客园 一个正则表达式测试(只可输入中文、字母和数字) - xujh - 博客园 IE6、7下如何设置页面内部件高度和窗口等高(heihgt:100%) HP大中华区总裁孙振耀退休感言 C#的一个双缓冲显示的例子 【ASP.NET】防止ASP.NET按钮多次提交的办法 【ASP.NET】FCKeditor 2.6 + Asp.Net 设置 在VS2005下配置手机设备仿真器访问局域网 [Delphi] 截屏存盘 C# 画圆角矩形 有意思的加菲猫语录 [Delphi]用Delphi7访问.NET 2.0的WebService 转贴[ASP.NET]基于Forms认证的WebService应用 ASP.NET优秀博客搜集 [转贴]DataGrid中的高级ToolTip
【ASP.NET】FreeTextBox的使用方法
xujh · 2007-11-05 · via 博客园 - xujh

Posted on 2007-11-05 22:22  xujh  阅读(2856)  评论()    收藏  举报

  • 点击就可以了,下完以后是个压缩文件,解压开来,有这几个主要文件:

    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>