Thursday, March 12, 2015

Asp .net MVC hidden field can't set value using jquery [Solved]

My hidden field is declared like this:
@Html.HiddenFor(model => model.Token, new { ClientIDMode = "Static" })

Then assign the value bellow way in hidden field
 var token = response.id;                    
 $('#Token').val(token);

Mention: You have to Set ClientIDMode="Static" and then you can use $('#Token').val(token); to set the value in asp.net hidden

Happy programming !

No comments:

Post a Comment