Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8779735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:52:20+00:00 2026-06-13T19:52:20+00:00

I’m using markdown and I’ve got some input such as **test** which makes the

  • 0

I’m using markdown and I’ve got some input such as **test** which makes the word test appear in bold test and I’ve converted it with html like so”

                var converter1 = Markdown.getSanitizingConverter();
                var editor1 = new Markdown.Editor(converter1);
                editor1.run();

                var d = document.getElementById("wmd_input");
                var html = converter1.makeHtml(d.value);
                alert(html);

And this alerts <b>test</b> the issue is I need to take this value, namely <b>test</b> and access this via server side code (asp.net). I tried assigning it to a variable like so:

                document.getElementById("Label1").value = html;

But it doesn’t seem to work, when I go to the code behind it shows Label1 as being empty.
Is this possible?

Edit

I tried to change it to a hidden field same issue:

<script type="text/javascript">
                (function () {
                    var converter1 = Markdown.getSanitizingConverter();
                    var editor1 = new Markdown.Editor(converter1);
                    editor1.run();

                    var d = document.getElementById("wmd_input");
                    var html = converter1.makeHtml(d.value);
                    alert(html);

                    document.getElementById('<%= h1.ClientID %>').value = html;
                    var h = document.getElementById('<%= h1.ClientID %>');
                    alert(h.value);
                })();
            </script>

The issue I have is I have an asp.net server side button that when clicked I try to do this:

Label1.Text = h1.Value;

That is to store the value from the hidden field to a label but this doesnt work. When I put a break point in it shows h1 is empty ""….So I’m not sure what event or how to do this so that when I make changes to my textarea wmd_input that i should be able to see these changes in my server side code…

Here’s my entire asp.net form:

<html>
    <head>
        <title>PageDown Demo Page</title>
        <link rel="stylesheet" type="text/css" href="css/demo.css" />
        <script type="text/javascript" src="js/Markdown.Converter.js"></script>
        <script type="text/javascript" src="js/Markdown.Sanitizer.js"></script>
        <script type="text/javascript" src="js/Markdown.Editor.js"></script>
    </head>
    <body>
        <form id="myForm" runat="server">
            <div class="wmd-panel">
                <div id="wmd-button-bar"></div>
                <textarea cols="5" rows="5" id="wmd_input" class="wmd-input" runat="server"></textarea>
                <div id="wmd_preview" class="wmd-panel wmd-preview" runat="server"></div>
            </div>
            <asp:button id="Button1" runat="server" Text="Set" onclick="Button1_Click"></asp:button>
            <asp:button id="Button2" runat="server" Text="Get" onclick="Button2_Click"></asp:button><asp:label id="Label1" runat="server">Label</asp:label>
            <asp:HiddenField ID="h1" runat="server" EnableViewState="true" />
            <script type="text/javascript">
                (function () {
                    var converter1 = Markdown.getSanitizingConverter();
                    var editor1 = new Markdown.Editor(converter1);
                    editor1.run();

                    var d = document.getElementById("wmd_input");
                    var html = converter1.makeHtml(d.value);
                    alert(html);

                    document.getElementById('<%= h1.ClientID %>').value = html;
                    alert(document.getElementById('<%= h1.ClientID %>').value);
                })();
            </script>
        </form>
    </body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:52:22+00:00Added an answer on June 13, 2026 at 7:52 pm

    The asp:Label tag isn’t an input control, so it won’t get posted back to the server. I’d suggest using asp:HiddenField or asp:TextBox instead. (And Adil’s point is crucial too, you need to make sure the client ID is actually what you think it is.)


    Here’s a test that works for me. On the first page load, the label shows “initial value”, but the alert shows “updated”. After postback, the label also shows “updated”.

    Edit Added the client-side update logic inside a client-side event handler.

    <%@ Page Title="Test" Language="C#" AutoEventWireup="true" %>
    
    <script runat="server">
        void Page_Load()
        {
            l1.Text = h1.Value;
        }
    </script>
    
    <html>
    <body>
        <form runat="server">
            <asp:HiddenField runat="server" Value="initial value" ID="h1" />
            <asp:Label runat="server" ID="l1" />
            <asp:Button runat="server" Text="do postback" />
        </form>
    
        <script>
            document.getElementById('<%= Button1.ClientID %>').onclick = function () {
                document.getElementById('<%= h1.ClientID %>').value = 'updated';
                alert(document.getElementById('<%= h1.ClientID %>').value);
            };
        </script>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have an autohotkey script which looks up a word in a bilingual dictionary
i got an object with contents of html markup in it, for example: string
I have thousands of HTML files to process using Groovy/Java and I need to
I need to clean up various Word 'smart' characters in user input, including but
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.