ASP.Net MVC - 将值从 Jquery 分配给视图

发布于 2024-12-12 21:54:09 字数 178 浏览 3 评论 0原文

我在 Jquery 中有一个值。我需要将该值应用于具有模型的视图。 例如,我需要将其分配给以下内容:

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

我尝试存储在 model.programid 中的变量称为 progid。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

春庭雪 2024-12-19 21:54:09
$('#programid').val(...)

如果您使用编辑器模板,则需要添加 @ViewData.TemplateInfo.HtmlFieldPrefix

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文