Add DLL free Richtextbox download available dll here FreeTextbox . After download dll from that site create one new website in visual studio and add FreeTextbox
http://www.freetextbox.com/ dll reference to newly created website after that design aspx page like this:
- <%@ Register Assembly="FreeTextBox" Namespace="FreeTextBoxControls" TagPrefix="FTB" %>
- <html xmlns="http://www.golivecode.com/xhtml">
-
- <head runat="server">
- <title>Richtextbox Make BY Pintoo</title>
- <script type="text/javascript">
- function validate() {
- var doc = document.getElementById('Richtextbox');
- if (doc.value.length == 0) {
- alert('Please Enter data in Richtextbox');
- return false;
- }
- }
- </script>
- </head>
-
- <body>
- <form id="form1" runat="server">
- <div>
- <table>
- <tr>
- <td>
- <FTB:FreeTextBox ID="Richtextbox" runat="server">
- </FTB:FreeTextBox>
- </td>
- <td valign="top">
- <asp:GridView runat="server" ID="gvdetails" AutoGenerateColumns="false">
- <Columns>
- <asp:TemplateField HeaderText="RichtextBoxData">
- <ItemTemplate>
- <asp:Label ID="lbltxt" runat="server" Text='<%#Bind("RichtextData") %>' />
- </ItemTemplate>
- </asp:TemplateField>
- </Columns>
- </asp:GridView>
- </td>
- </tr>
- </table>
- </div>
- <asp:Button ID="btnSave" runat="server" OnClientClick="return validate()" Text="Submit" onclick="btnSave_Click" />
- <br />
- <asp:Label ID="lbltxt" runat="server" />
- </form>
- </body>
-
- </html>
After that run your application richtextbox appears like this:
- SqlConnection con = new SqlConnection("Data Source=golivecode;Integrated Security=true;Initial Catalog=TExt3");
- protected void Page_Load(object sender, EventArgs e) {
- if (!IsPostBack) {
- BindGridview();
- }
- }
- protected void BindGridview() {
- con.Open();
- SqlCommand cmd = new SqlCommand("select data from TextBoxData", con);
- SqlDataAdapter da = new SqlDataAdapter(cmd);
- DataSet ds = new DataSet();
- da.Fill(ds);
- gvdetails.DataSource = ds;
- gvdetails.DataBind();
- }
- protected void btnSubmit_Click(object sender, EventArgs e) {
- con.Open();
- SqlCommand cmd = new SqlCommand("insert into data(data) values(@data)", con);
- cmd.Parameters.AddWithValue("@data", Rich.Text);
- cmd.ExecuteNonQuery();
- con.Close();
- RichTextBox1.Text = "";
- BindGridview();
- }