Solved

Getting / Setting asp.net hidden control value based on id using JQuery

Posted on 2011-02-21
4
1,095 Views
Last Modified: 2012-08-14
Hi,

How to Get/ Set asp.net hidden control value based on id using JQuery

Thanks,
Ajay Varma
0
Comment
Question by:ajayvegesna02
  • 2
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
robasta earned 500 total points
ID: 34941988
0
 
LVL 14

Expert Comment

by:robasta
ID: 34941996
0
 
LVL 10

Expert Comment

by:P1ST0LPETE
ID: 34943332
Here is a simple working demonstration for you:

 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function ()
        {
            $('#btGet').click(function ()
            {
                var value = $('#hiddenfield1').val();
                alert(value);
            });

            $('#btSet').click(function ()
            {
                var value = $('#textbox1').val();
                $('#hiddenfield1').val(value);
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:HiddenField ID="hiddenfield1" runat="server" Value="ABCD" />
        <span>Hidden Field 1:</span>
        <asp:TextBox ID="textbox1" runat="server" Text="1234" />
        <asp:Button ID="btGet" runat="server" Text="Get" />
        <asp:Button ID="btSet" runat="server" Text="Set" />
    </div>
    </form>
</body>
</html>

Open in new window

0
 
LVL 10

Expert Comment

by:P1ST0LPETE
ID: 34943348
Oops, didn't realize you had already closed out the question.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now