Get the Value of an asp:HiddenField using jQuery

后端 未结 8 2240
慢半拍i
慢半拍i 2020-12-15 16:36

I have two pages. From the first page, I open a modal with a querystring that holds that value of a client name. I then use this to set a hiddenfield on the modal that opene

相关标签:
8条回答
  • 2020-12-15 17:04

    If you are using Asp.net controls, the server will mangle the control ids. It adds a bunch of extraneous control tree hierarchy information into the id. You need to reference what that acutal id is that's getting rendered, which is availble with the ClientID property on the control (hfUser.ClientID) or access your control in a different, more roundabout way, like find the controls parent, then search through its children to find your control.

    If you don't have to use the asp.net HiddenField control, try just using a regular old html input.

    0 讨论(0)
  • 2020-12-15 17:04

    Please try this code.

     var hv = $("#<%= hidClientField.ClientID %>").val();
    
    0 讨论(0)
提交回复
热议问题