0

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.

1 Answer 1

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

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

Sign up to request clarification or add additional context in comments.

2 Comments

Mines is slighly more complicated than the above. I have @Html.HiddenFor(model => model.program.programid). Just wondering how I would reference it as not working. Thank you.
The .s become _s, as you can see in the page source.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.