My hidden field is declared like this:
Then assign the value bellow way in hidden field
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 !
@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 !