How to use the. NET control Freetextbox

Source: Internet
Author: User
Tags insert
Control 1. Add the Freetextbox.dll to the project first

2. Ftb.colorpicker.aspx-The
-Ftb.imagegallery.aspx
-Ftb.inserttable.aspx
Copy from folder Helperscripts, put it outside with-test.aspx (test) same rank directory,
(Do not do this, insert background color, picture, form is not good to make)

3. Put the images folder in the Test.aspx (test) Same level directory, to store uploaded pictures.

4. In test.aspx, add the path of the picture
<ftb:freetextbox id= "FreeTextBox1" runat= "width=" buttonpath= "\images\ftb\office2003\"/>

This. Freetextbox1.text This is the content of the text you entered in FTB, which is HTML-tagged

This. Freetextbox1.htmlstrippedtext This is the text that removes the HTML tag

5. Write to Database
On the CSDN, I saw my friends say how to write Freetextbox content to the database
I did it. is to insert all the generated HTML code into a field in the database
Can make a news table
News
Field ID (self-increasing) content Addtime (getdate)
private void Page_Load (object sender, System.EventArgs e)
{
Put user code to initialize the page here
if (! IsPostBack)
{
SqlConnection myconn = new SqlConnection ("server= (local); database=mm;uid=sa;pwd=123");
SqlCommand mycmd = new SqlCommand ("SELECT * from Test where id=2", myconn);
MyConn.Open ();
SqlDataReader myDR;
Mydr=mycmd.executereader ();
Mydr.read ();
Response.Write (mydr["content"). ToString ());
Mydr.close ();
Myconn.close ();
}
}

private void Button1_Click (object sender, System.EventArgs e)
{
SqlConnection myconn = new SqlConnection ("server= (local); database=mm;uid=sa;pwd=123");
SqlCommand mycmd = new SqlCommand ("INSERT into test (content) VALUES (' +freetextbox1.text+" '), myconn);
MyConn.Open ();
Mycmd.executenonquery ();
Myconn.close ();
}

[Note]web.config
In the system.web section, add:
<pages validaterequest= "false"/>

The above is my own method of use, not necessarily very good. If you find a better way, don't forget to tell me!




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.