Click here to Skip to main content
15,916,463 members
Please Sign up or sign in to vote.
3.67/5 (2 votes)
Hello

how are you guys?

i have asp.net webform its for adding news in the news content i would like to use summernote Summernote - Super Simple WYSIWYG editor[^] as a WYSIWYG editor so could some one please help me to save the data from this editor

this is my code

ASP.NET
<div class="form-body">
    <div class="form-group last">
        <label class="control-label col-md-2">News Content</label>
        <div class="col-md-10">
        <div name="summernote" id="summernote_1"> </div>
            <asp:label runat="server" text="Label" ID="news_con" ></asp:label>
        </div>
    </div>
</div>


i can't get the text value from the summernote

What I have tried:

i can't get the text value from the summernote
by this code
C#
news_con.Text = Request.Form["summernote_1"];
Posted
Updated 9-Mar-17 1:40am
v4
Comments
Mehdi Gholam 8-May-16 6:10am    
Contact the author of Summernote for help.
Kornfeld Eliyahu Peter 8-May-16 6:43am    
Use CKEditor instead...
Eng Abdull A-ziz 10-May-16 4:34am    
its something very poor also the features is limited

1 solution

You can get the html as follows:
var myHtml = $('#summernote').summernote('code');


Example (not complete, will need editing)
<head runat="server">
	<script language="javascript" type="text/javascript">
       function funcMyHtml() {
           debugger;
           document.getElementById("myHtml").value = $('#summernote').summernote('code');
       }
   </script>
</head>			

<body>
	<asp:HiddenField ID="myHtml" Value="0" runat="server" />
	<asp:Button ID="Button1" runat="server"  OnClientClick="funcMyHtml();" Text="Get my html" onclick="Button1_Click" />
</body>

C#
// C# code behind:
string myHtmlNew = myHtml.Value;
 
Share this answer
 
v2
Comments
Eng Abdull A-ziz 10-May-16 4:35am    
where can i use this code
RickZeeland 10-May-16 6:06am    
You can do this in the html part of your page, or create code that generates the javascript in the page.
See "Using JavaScript Along with ASP.NET" https://msdn.microsoft.com/en-us/library/aa479011.aspx
Or: Client Script in ASP.NET Web Pages https://msdn.microsoft.com/en-us/library/3hc29e2a.aspx
Eng Abdull A-ziz 10-May-16 8:13am    
can you please help me with the code i already read this article but i don't know how to apply it on my case
RickZeeland 10-May-16 8:55am    
See the updated solution.
Eng Abdull A-ziz 14-May-16 9:59am    
its take nothing but 0 only idk

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900