Nate Pet
Nate Pet

Reputation: 46222

ASP.Net MVC - Assign value from Jquery to View

I have a value in Jquery. I need to apply that value to a view which has a model. For example, I need to do assign it to the following:

    @Html.HiddenFor(model => model.programid)

the variable that I am trying to store in model.programid is called progid.

Upvotes: 0

Views: 348

Answers (1)

SLaks
SLaks

Reputation: 887305

$('#programid').val(...)

If you're in an editor template, you'll need to add @ViewData.TemplateInfo.HtmlFieldPrefix

Upvotes: 1

Related Questions