Nicedit insert value in asp:textbox converted to nicedit(or) RRS feed

  • Question

  • User2146470223 posted


    I got a small problem with Nicedit with asp:textbox in vb.net.

    I got nicedit convert the textbox successfully and I can retrieve the value from the editor but how do I insert a given value back to the editor through javascript. I already tried to find a solution for 2 days now, without getting further. Maybe I missed something.

    To get the value from the editor I had to use jquery (if I understood it right) but I don't really know jquery. Before asp.net I used nicedit in asp with simple javascript commands that do not work here anymore.

    As reference, here is the working code I already have on my aspx page: (the part I got probs with is at the end within the javascript functions)

    <%@ Page Title="" Language="VB" Async="true" validateRequest="false" MasterPageFile="site.master" Debug="true" AutoEventWireup="false" CodeFile="eifeler-regel-letzebuergesch-checker.aspx.vb " Inherits="eifeler_regel_letzebuergesch_checker" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <script src="https://www.translating-it.eu/nicEdit.js" type="text/javascript"></script>
    <script src="https://www.translating-it.eu/scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
        <script type="text/javascript">bkLib.onDomLoaded(nicEditors.allTextAreas);</script>
        <div id="textarea">
            <div class="text3">
                <p><%=Resources.text.erc2.Replace(""" & go & """, Resources.text.go)%></p>
                <p><body onload="addZeile(document.getElementById('content'))">
                <div id="statusBorder">
                    <div id="statusFill">
                   If InStr(Request.ServerVariables("HTTP_USER_AGENT"), "Pzlo") > 0 Then
                       <form name="aufnahme2" id="aufnahme2" method="post">
                       <p class="pos_fixed"><input id="gre" type="button" name="Richtig" value="Richtig" onclick="ShowSelection(content);"></p>
                       <p class="pos_fixed4"><input id="rout" type="button" name="Falsch" value="Falsch" onclick="ShowSelection2(content);"></p>
                       <p class="pos_fixed2"><textarea id="arry" name="arry" onkeydown="setTimeout('addZeile(document.getElementById(\'arry\'))',10)" style="font-size:14px;" cols="70" rows="2"></textarea></p>
                       <p class="pos_fixed3"><input type="hidden" name="aktion" value="aufwoerter"><input type="submit" value="Aufnehmen"></p></form>
                       <form name="aufnahme3" id="aufnahme3" method="post">
                       <p><textarea id="arry2" name="arry2" onkeydown="setTimeout('addZeile(document.getElementById(\'arry2\'))',10)" style="font-size:14px;" cols="70" rows="2"></textarea></p>
                       <p><input type="hidden" name="aktion" value="aufnehmall"><input type="submit" value="Aufnehmen"></p></form>
                    End If
                <%   '<input type="hidden" name="aktion" value="aufnehmall"><input type="submit" value="=Resources.text.go" onclick="progbar();"></form></p>
                   '<input type="hidden" name="aktion" value="aufnehmall"><input type="submit" value="<%= Resources.text.go" onclick="progbar();">
                <form runat="server" name="aufnahme" id="Form1" method="post">
                    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <asp:textbox runat="server" textmode="MultiLine" id="content" style="font-size:14px; width: 650px; height: 200px;" rows="10" Text="" />
                            <asp:HiddenField ID="hdnNicEdit" runat="server" />
                            <br /><br />
                            <asp:Button runat="server" ID="cmdGetTime" Text="" onclick="aufbereit" OnClientClick="SaveContent()" />
                <input type="hidden" name="aktion" value="aufnehmall"></form></p>
    <script type="text/javascript">
        function SaveContent() {
            var data = $("#<%=content.ClientID%>").val();
            document.getElementById('<%= hdnNicEdit.ClientID%>').value = data;
            var newdata = document.getElementById('<%= hdnNicEdit.ClientID%>').value;
            var newdata = 'test successful';
            // how do I enter the new value (newdata) into the editor with ID=content

    I need to address the editor with ID=content, so how do I enter the variable newdata into that editor?

    Thanks for the help,


    Wednesday, January 7, 2015 7:05 PM