隐藏不适用于对象类型

时间:2014-11-10 10:51:10

标签: c# asp.net-mvc html.hiddenfor

public class StepModel
{
    public FirstStepModel m1 { get; set; }
    public SecondStepModel m2 { get; set; }
    public ThirdStepModel m3 { get; set; }
    public FourthStep m4 { get; set; }
}

在视图中

@using (Html.BeginForm("SecondStep","Steps",FormMethod.Post))
{ 
    @Html.HiddenFor(model => model.m1)>===>Not holding M1 type object giving null value when I posted it is working fine if use m1.property
    @Html.EditorFor(model => model.m2.secondStepProp)
    <input type="submit" value="Next"/>
}

请让我知道如何使用hidden来保存m1类型而不是m1.Prop

0 个答案:

没有答案