.net控制項FreeTextBox使用方法

來源:互聯網
上載者:User

Freetextbox是一個免費的.net mshtml 編輯器。ITPUB個人空間Bt1nqhr"Ib
我所用的免費的freetextbox版本是中文版本1.6.3的漢化的freetextbox。ITPUB個人空間Lp$bT:u(kW-]{
獲得的地址。http://www.percyboy.com/w/ftb/
s|,X%QA+l#[:e0下載之後仔細看看其中的說明,你就可以使用這個完美的編輯器。
?#k$gTS0其中樣本是在內聯代碼方式下,如果在代碼後置下使用Freetextbox 呢。
,Cw/k0V)d*H0N#Vp%F4y01、首先我們把 FreeTextBox.DLL 檔案copy到我們的項目中的bin目錄裡。ITPUB個人空間+x/Di/W3O} m;BTB
然後在我們的項目裡添加新的引用,在添加引用對話方塊選擇項目標籤,瀏覽/選擇你的FreeTextBox.dll/開啟/確定。應用就添加完成了。
P%q.Z;swb~)F0
qeS+DN)x0[02、如何獲得FreeTextBox.dll 中所使用到的名字空間,本中文版本1.6.3 有3個名字空間。
k#v6E)}S;]1W0using FreeTextBoxControls;
using FreeTextBoxControls.Design;
using FreeTextBoxControls.Common;ITPUB個人空間R*O/d d1E
可以在引用的FreeTextBox.dll 查看對象瀏覽。
q:K/_ e O D?.bD0點開樹型目錄就可以清晰的看到,上面所說的名字空間了。ITPUB個人空間s{6T'm4g-_%Q:X4c
其他的版本類似可以獲得。
@0N/vm(h*B03、在aspx檔案添加freetextbox
&GI+BaK Q%`0<%@ Register TagPrefix="ftb" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
J*z{3A YKf0具體的方法和內聯一樣的。
4D&_2P}3d2ij-a0同時cs檔案中會有如下代碼:
protected FreeTextBoxControls.FreeTextBox FreeTextBox1;產生
a+V0@k GZ)r}H0添加完後,運行一下就可以看到結果了。
qR+s E2@0在設計模式下我們還可以查看FreeTextBox 屬性。
b KJ$b1@bo J)R04、如何把FreeTextBox 內容寫到資料庫,我們在aspx檔案中添加一個bottomITPUB個人空間:J;a2i/|saC
其的onclick=“my_add"ITPUB個人空間g:xzS+?9UN
cs檔案ITPUB個人空間&m4C7M6E5k{
protected void my_add(object sender, System.EventArgs e)ITPUB個人空間'r:T,rQ[C[(?|I:ag
        {ITPUB個人空間7OL%D&s@%eJ
            // 在此處放置使用者代碼以初始化頁面
           Response.Write(FreeTextBox1.Text);
  }
此處是輸出內容,可以改成我們需要方法。

 

可以做一個新聞表

news

欄位ID(自增)contentaddtime(getdate)
privatevoidPage_Load(objectsender,System.EventArgse)
{
//Putusercodetoinitializethepagehere
if(!IsPostBack)
{
SqlConnectionmyConn=newSqlConnection("server=(local);database=mm;uid=sa;pwd=123");
SqlCommandmyCmd=newSqlCommand("select*fromtestwhereid=2",myConn);
myConn.Open();
SqlDataReadermyDr;
myDr=myCmd.ExecuteReader();
myDr.Read();
Response.Write(myDr["content"].ToString());
myDr.Close();
myConn.Close();
}
}
privatevoidButton1_Click(objectsender,System.EventArgse)
{
SqlConnectionmyConn=newSqlConnection("server=(local);database=mm;uid=sa;pwd=123");
SqlCommandmyCmd=newSqlCommand("insertintotest(content)values('"+FreeTextBox1.Text+"')",myConn);
myConn.Open();
myCmd.ExecuteNonQuery();
myConn.Close();
}

[注]web.config

在system.web節加入:

下載:

http://www.percyboy.com/w/ftb/down/FTB_1.6.3_zh.zip

 

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.