HTML.HiddenFor值集 [英] HTML.HiddenFor value set

查看:126
本文介绍了HTML.HiddenFor值集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

@Html.HiddenFor(model => model.title, new { id= "natureOfVisitField", @value = '@Model.title'})

它不起作用!如何设置值?

it doesen't work! how to set the value?

推荐答案

您不需要在attributes参数中设置值. MVC应该会自动为您绑定它.

You shouldn't need to set the value in the attributes parameter. MVC should automatically bind it for you.

@Html.HiddenFor(model => model.title, new { id= "natureOfVisitField" })

这篇关于HTML.HiddenFor值集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆