Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have an < asp:menu/> control and a hidden field.Now i am using jquery to change value of hidden field. Code is:-
C#
$(function() {

    $(".primaryStaticMenu  tr,td").each(function(index) {

        $(this).click(function() {

            if ($(this).attr("title") != "undefined"
                && $(this).attr("title").length > 0) {

                document.getElementById('ctl00_Hidden_Master_Location').value = $(this).attr("title");

                alert(document.getElementById('ctl00_Hidden_Master_Location').value);
                //return false;
            }
        });
    });
});


Server side code to get updated value is:-
String Get_cng_value = Hidden_Master_Location.Value;

But Hidden_Master_Location.Value shows null every time. can any one tell me how to get updated value of hidden field code behind.
Posted
Comments
ZurdoDev 5-Mar-13 7:00am    
What is causing the server-side code to run?

Hi,

Try using something like this:

C#
var val = Request.Form["ctl00_Hidden_Master_Location"];


If you can't find it, try inspecting:

C#
Request.Form.AllKeys


Hope it helps
 
Share this answer
 
If u r setting the property for hidden field value runat="server" then it is available under server side also then you can get the id under codebehind also.please try to like this.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900