Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

300
Views
How to access hidden field value from java script code(Client side) in asp.net c#

I have defined hidden field in .aspx page(ui)

 <asp:HiddenField ID ="hdnExport" runat="server" />

Set the value in the following code (java script)

$(document).ready(function () {
            $("#btn_FinalConfirmOK").on("click", function (event) {
                alert("clicked");
                //document.getElementById("hdnExport").value = "yes";
                $('#hdnExport').val("yes");
               
                alert($('#hdnExport').val());

                document.getElementById('hdnExport').value = "yes";
                //alert("yes");
            });
        });

Then accessing hidden field value in aspx.cs code is given below,

string exportValue = Convert.ToString(hdnExport.Value);
        string exp = hdnExport.Value.ToString();
        var val = this.hdnExport.Value;
        string latitudeValue = Request.Form[hdnExport.Value];

Tried with different ways. but i didn't get value from hidden field. how to solve this issue

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

By default, the rendered id will differ from the ID specified within C# (hdnExport). Therefore, (#hdnExport) is likely an invalid selector thus no value is set.

Try setting ClientIDMode="Static" on the HiddenField:

 <asp:HiddenField ID ="hdnExport" ClientIDMode="Static" runat="server" />

This will ensure the hidden field is rendered with id as ID which would make #hdnExport valid.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!