Solved

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

Posted on 2011-02-21
4
1,097 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ASP.net Run 3 sliders vertically as opposed to horizontally 9 21
Entity Framework 7 41
daypilot scheduler 3 26
transaction in asp.net, sql server 6 31
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

776 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