Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

302
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda