javascript - Not getting updated test in tinyMCE editor -


i using tinymce showing editor in asp.net site add , edit article functionality. code follows

<script type="text/javascript" language="javascript">              tinymce.init({         // general options         mode: "exact",         elements: '<%=txttextbox.clientid%>',         theme: "advanced",         width: "650",         height: "500",         plugins: "style,advhr,advimage,advlink,inlinepopups,preview,media,searchreplace,contextmenu,paste,noneditable,visualchars,nonbreaking,wordcount",         // theme options                     theme_advanced_buttons1: "undo,redo,separator,bold,italic,underline,separator,cut,copy,paste,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent,indent,separator,image,media,link,separator,forecolor,backcolor,separator,preview",         theme_advanced_buttons2: "fontsizeselect,fontselect",         theme_advanced_buttons3: "",         theme_advanced_font_sizes : "10px,12px,14px,16px,24px",         theme_advanced_toolbar_location: "top",         theme_advanced_toolbar_align: "left",         theme_advanced_statusbar_location: "bottom",         theme_advanced_resizing: false,         relative_urls: true,         remove_script_host: true,         document_base_url: ""     });          </script>    <div>     <textarea id="txttextbox" runat="server" cols="500" rows="100"></textarea>     <asp:button id="button1" runat="server" text="save" onclick="button1_click" />     <asp:button id="button2" runat="server" text="update" onclick="button2_click" onclientclick="return test();" /> </div>   

this code adds whatever typed in editor in db html. works fine. editing retrieve article record , show content in textbox on page load

   string sql = "select * content_table id=1";    comm = new sqlcommand(sql, conn);    da = new sqldataadapter(comm);    dataset ds = new dataset();    da.fill(ds);     if (ds != null)    {                   txttextbox.innertext = server.htmldecode(ds.tables[0].rows[0]["content"].tostring());    } 

but problem not getting new changed text instead text on page load. why happening. suggestion?

because updating textarea - not editor. use:

var new_content = server.htmldecode(ds.tables[0].rows[0]["content"].tostring(); tinymce.get('your_editor_id').setcontent(new_content); // editorid equals textarea id 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -