javascript - tinymce no value when c# button is clicked -
i content of tinymce in backend i'm ending no values returned.
this have:
html markup:
<asp:content id="content1" contentplaceholderid="maincontent" runat="server"> <script type="text/javascript" src="/tinymce/js/tinymce/tinymce.min.js"></script> <div style="margin-top: 50px;"> <span>set content left side content</span> <script type="text/javascript"> tinymce.init({ selector: "textarea", theme: "modern", image_advtab: true, templates: [ {title: 'test template 1', content: 'test 1'}, {title: 'test template 2', content: 'test 2'} ] }); </script> <textarea id="leftcontent" runat="server" name="content" style="width:100%"></textarea> </div> <div style="margin-top: 50px;"> <span>set content right side content</span> <script type="text/javascript"> tinymce.init({ selector: "textarea", theme: "modern", image_advtab: true, templates: [ { title: 'test template 1', content: 'test 1' }, { title: 'test template 2', content: 'test 2' } ] }); </script> <textarea id="rightcontent" runat="server" name="content" style="width:100%"></textarea> </div> <div style="margin-top: 20px;" class="row"> <asp:button runat="server" id="btnsave" text="save" onclick="btnsave_onclick" cssclass="btn btn-success pull-right"/> </div> </asp:content>
backend:
protected void btnsave_onclick(object sender, eventargs e) { string test = leftcontent.innerhtml; string t2 = rightcontent.innerhtml; }
any idea doing wrong?
thanks, laziale
you may try call following on button click:
tinymce.triggersave();
and send editor content eigther using updated textarea content or editor content directly using tinymce.get('leftcontent').getcontent();
Comments
Post a Comment