Setting a value to a HiddenField in ASP.NET 4.5

前端 未结 2 826
遇见更好的自我
遇见更好的自我 2020-12-18 01:43

I\'m having some issues setting a value to a HiddenField in ASP.NET 4.5.

From what I\'ve seen I\'ve tried the following without any luck:

In ASPX:

         


        
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-18 02:11

    In the hidden field tag add clientid static like this -

    
    

    This way ASP.Net will not replace it with dynamic ID and always have the id that you provided, so it will now have ID HiddenField. Then your second attempt should work.

    More can be found here -

    http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientidmode(v=vs.110).aspx

提交回复
热议问题