Search code examples
c#asp.netckeditorckeditor4.x

CKEditor has Empty Value on asp:textbox


I have implemented CKEditor on my Visual Studio 2013 and it has been showed clearly with asp:TextBox element.

But somehow while I fetch the value it returns empty.

This is my code:

<div class="row">
  <div class="col-md-11">
    <asp:TextBox ID="bodyMessageTextBox" runat="server"/>
    <script type="text/javascript">
      CKEDITOR.replace("ctl00_ContentPlaceHolder1_bodyMessageTextBox");
    </script>
  </div>
</div>

I fetch with this method;

_msemailsetup.BodyMessage = this.bodyMessageTextBox.Text;

Can someone help me solve this?


Solution

  • You will get the data with below code :

    Inspect (press f12 on browser) the browser and then check the name of editor

     var editorText = CKEDITOR.instances.bodyMessageTextBox.getData();
     _msemailsetup.BodyMessage = editorText ;