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

  • Home
  • SEARCH
  • 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 4073066
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:58:00+00:00 2026-05-20T16:58:00+00:00

Is there a way to send data to an aspcontrol say a label called

  • 0

Is there a way to send data to an aspcontrol say a label called label1? Via jquery?

I know jquery only likes html but is there a way to just send the raw text to an asp control using a similar method below:

 <script type="text/javascript">
    $(function () {
        $('button').click(function () {

            $(document).ready(function () {
                var x = $('textarea').val();
                $('textarea').val('');
                var label = $("#<%= Label1.ClientID %>");
                var newdiv = $("<div></div>").html(x).attr('id', 'test');
                $('#test1').append(newdiv);
                var serializer = new XMLSerializer();
                label.text(serializer.serializeToString(newdiv));
                return false;
            });
        });
    });
</script>
  • 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-05-20T16:58:00+00:00Added an answer on May 20, 2026 at 4:58 pm

    I think the bigger issue is asp.net changes the id and trying to get that in the code isn’t that easy.

    Can you use the name attribute? If so you can just look for the name attribute containing your name using the jquery selector ‘[ name *=”YourName”]’

    EDIT: I meant to add firebug is a great help for examining page elements and figuring exactly what you can use (Ex: asp.net adds a name attribute to a button by default) and whats going on (like your return false failing) then tweaking your jquery from the watch window.

    Sample asp.net form content:

    <p>
        <asp:TextBox ID="TextBox1" name="TextBox1" runat="server" Rows="3"></asp:TextBox>
    </p>
    <p>
        <asp:Button ID="Button1" runat="server" Text="Button" /></p>
    <p>
        <asp:Label ID="Label1" name="Label1" runat="server" Text="Label"></asp:Label>
    </p>
    
    <div id="test1"></div>
    

    jquery:

    $(function () {
        $('[name*= "Button1"]').click(function () {
            var x = $('[name*= "TextBox1"]').val();
            var newdiv = $("<div></div>").html(x).attr('id', 'test');
    
            $('#test1').append(newdiv);
            $('[name*= "Label1"]').text($('#test1').html());
            $('[name*= "TextBox1"]').val('');
    
            return false;
    
        });
    });    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

beside swfaddress is there any other way to send data from a html page
Is there any way for developer to send data to the iPhone's USB port?
Is there a way a send custom (and event undemanded) arp responses via shell
Is there a way to send data to database when click on a link
I wanted to know if theres a way to send a JSON data along
Is there any way to have a subroutine send data back while still processing?
Is there a way I can send data to my PDF file, (fill in
Is there a better way to send float data over a socket? Below is
Is there a way to send a MIME email in which the body of
Is there a way, in C# code, to send an email without having to

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.