ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Insert value of TinyMCE editor to Database and display in ASP.Net GridView<p>Hi <a class="username" rel="eswardatta">eswardatta</a>,</p> <p>Please refer below article.</p> <h1 class="header"><a title="Save (Insert) and Retrieve (Display) TinyMCE contents from database in ASP.Net'a" href="https://www.aspsnippets.com/Articles/Save-Insert-and-Retrieve-Display-TinyMCE-contents-from-database-in-ASPNet.aspx">Save (Insert) and Retrieve (Display) TinyMCE contents from database in ASP.Net</a></h1> <p><span style="text-decoration: underline;"><strong>HTML</strong></span></p> <pre class="brush: html">&lt;script type=&#34;text/javascript&#34; src=&#34;//tinymce.cachefly.net/4.0/tinymce.min.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; &nbsp;&nbsp;&nbsp; tinymce.init({ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; selector: &#39;textarea&#39;, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width: 500, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height: 300, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resize: false &nbsp;&nbsp;&nbsp; });&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;/script&gt; &lt;div class=&#34;ScrollBar&#34;&gt; &nbsp;&nbsp;&nbsp; &lt;textarea name=&#34;txtHTMLContent&#34; class=&#34;ScrollBar&#34; rows=&#34;2&#34; cols=&#34;20&#34; id=&#34;txtHTMLContent&#34; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; runat=&#34;server&#34;&gt;&lt;/textarea&gt; &nbsp;&nbsp;&nbsp; &lt;br /&gt; &nbsp;&nbsp;&nbsp; &lt;br /&gt; &lt;/div&gt; &lt;asp:GridView ID=&#34;gvHtml&#34; runat=&#34;server&#34; AutoGenerateColumns=&#34;false&#34;&gt; &nbsp;&nbsp;&nbsp; &lt;Columns&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:BoundField DataField=&#34;Content&#34; HeaderText=&#34;Content&#34; HtmlEncode=&#34;false&#34; /&gt; &nbsp;&nbsp;&nbsp; &lt;/Columns&gt; &lt;/asp:GridView&gt;</pre> <p><span style="text-decoration: underline;"><strong>Namespaces</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">using System.Configuration; using System.Data.SqlClient;</pre> <p><span style="text-decoration: underline;"><strong>Code</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">protected void Page_Load(object sender, EventArgs e) { &nbsp;&nbsp;&nbsp; if (!this.IsPostBack) &nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string query = "SELECT [Content] FROM [HTMLContent]"; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string conString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; using (SqlConnection con = new SqlConnection(conString)) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; using (SqlCommand cmd = new SqlCommand(query, con)) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con.Open(); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; using (S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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con.Close(); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } &nbsp;&nbsp;&nbsp; } }</pre> <p><span style="text-decoration: underline;"><strong>Screenshot</strong></span></p> <p><img src="https://i.imgur.com/HsIXBqi.jpg" alt="" width="439" height="515" /></p>https://www.aspforums.net:443/Threads/202978/Insert-value-of-TinyMCE-editor-to-Database-and-display-in-ASPNet-GridView/https://www.aspforums.net:443/Threads/202978/Insert-value-of-TinyMCE-editor-to-Database-and-display-in-ASPNet-GridView/Tue, 17 Jul 2018 00:43:46 GMT