简体   繁体   English

无法在C#中获得Bootstrap所见即所得富文本编辑器的编辑器div的InnerHtml

[英]Unable to get the InnerHtml of the editor div of Bootstrap WYSIWYG rich text editor in c#

I am using Bootstrap WYSIWYG rich text editor for making HTML email templates. 我正在使用Bootstrap所见即所得的RTF编辑器来制作HTML电子邮件模板。 This works fine when I check in the browser. 当我在浏览器中签入时,这工作正常。

I can get the HTML contents of the editor div in JQuery by $("#editor").html(); 我可以通过$("#editor").html();在JQuery中获取编辑器div的HTML内容$("#editor").html();

I gave the editor div a runat="server" attribute in order to get the HTML content in the server side. 我给编辑器div一个runat =“ server”属性,以便在服务器端获取HTML内容。 But I am not able to get the editor div's HTML content in the server side. 但是我无法在服务器端获取编辑器div的HTML内容。

I tried to assign the HTML content to a hidden field and to access it in server side but still got no success :( 我试图将HTML内容分配给隐藏字段,并在服务器端访问它,但仍然没有成功:(

Any suggestions ??? 有什么建议么 ???

I solved this by setting the value of a hidden field and then accessing the hidden field from server side. 我通过设置隐藏字段的值,然后从服务器端访问隐藏字段来解决此问题。

 <asp:HiddenField ID="hdnBody" ClientIDMode="Static" runat="server" />

<script>
    function GetEmailID() {
        var emailIDs = $(".search-choice span").text();
        var bodyHtml = $("#editor").html();

        $("#hdnBody").val(bodyHtml);
        $("#hdnEmailIds").val(values);           

    }
</script>

Then in serverside 然后在服务器端

 string body = hdnBody.Value;

Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM