日期:2014-05-17  浏览次数:20425 次

mvc生成强类型编辑视图,如何绑定值
HTML code
        <div class="editor-label">
            @Html.LabelFor(model => model.UserRealName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.UserRealName)
            @Html.ValidationMessageFor(model => model.UserRealName)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.UserAddress)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.UserAddress)
            @Html.ValidationMessageFor(model => model.UserAddress)
        </div>


以上是自动生成的代码.
我现在有一个Users user.如何把user里面的值绑定到其中去

------解决方案--------------------
那就从控制器里返回要展示的这个Model,然后页面接受该Model