I am using tinyMCE for a nice text editor, but now I am trying to get the text I've inserted, I would like to know how that is possible. I've tried:

HTML CODE:

<textarea id="TA_MessageInput"></textarea>
<asp:HiddenField id="HF_MessageInput" ClientIDMode="static" runat="server"/>

JAVASCRIPT CODE:

<script type="text/javascript">
    function getTinyMCEText() {
        document.getElementById('<%= HF_MessageInput.ClientID %>').Value = tinyMCE.activeEditor.getContent();
        alert(document.getElementById('<%= HF_MessageInput.ClientID %>').Value);
    };
</script>

ASP.NET CODE:

ScriptManager.RegisterClientScriptBlock(this, GetType(), "", "getTinyMCEText()", true);
String text = HF_MessageInput.Value;

The javascript gives me the alert that the tag has been filled, unfortunately it did not for ASP.NET, this says it is still null.

Related posts

Recent Viewed