本文介绍了如何将summernote中的数据保存到SQL DB中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 你好 你好吗? i有asp.net webform用于添加新闻在新闻内容中我想使用summernote Summernote - Super Simple WYSIWYG编辑器 [ ^ ]作为WYSIWYG编辑器,所以有人可以帮我保存这个编辑器中的数据 这是我的代码 < div class = form-b​​ody > < div class = for m-group last > < label class = control-label col-md-2 > 新闻内容< / label > < div 类 = col-md-10 > < div 名称 = summernote id = summernote_1 > < / div > < asp:label runat = server text = 标签 ID = news_con > < / asp:label > < / div > < / div > ; < / div > i无法从summernote获取文本值 我尝试了什么: i无法从summernote获取文本值/> 此代码 news_con.Text = Request.Form [ summernote_1]; 解决方案 您可以按如下方式获取html: var my Html = ('#summernote')。summernote('code'); 示例(不完整,需要编辑) < head runat =server> < script language =javascripttype =text / javascript> 函数funcMyHtml(){ debugger; document.getElementById(myHtml)。value = ('#summernote')。summernote('code'); } < / script> < / head> < body> < asp:HiddenField ID =myHtmlValue =0runat =server/> < asp:Button ID =Button1runat =serverOnClientClick =funcMyHtml(); Text =Get my htmlonclick =Button1_Click/> < / body> // C#代码背后: string myHtmlNew = myHtml.Value; 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<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 summernoteWhat I have tried:i can't get the text value from the summernoteby this codenews_con.Text = Request.Form["summernote_1"]; 解决方案 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# code behind:string myHtmlNew = myHtml.Value; 这篇关于如何将summernote中的数据保存到SQL DB中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-17 01:43