Html.textbox不显示模型属性值

时间:2013-02-27 12:18:01

标签: asp.net-mvc asp.net-mvc-2

我的asp.net mvc应用程序中有一个模型类。在控制器操作中,我传递的模型如下所示:

public ActionResult PlayAPI(string CallIDno)
{
    CallRecording callRecording = new CallRecording();
    using (ICallRecordingManager callRecordingManager = new ManagerFactory().GetCallRecordingManager()) {
        callRecording = callRecordingManager.GetAll().Where(c => c.CallIDNumber == CallIDno).FirstOrDefault();            
    }
    return View("PlayApi", callRecording);
}

在视图中我正在使用它:

<div class="flds-up">
    <div class="lft-txt">
        Call ID Number
    </div>
    <div class="new-fld">
        <%= Html.TextBoxFor(model => model.CallIDNumber, new { @class = "textarea required email"  })%>
    </div>
    <div class="clear-n">
    </div>
</div>

但是虽然db记录有值,但textbox是空的。我可以使用Html.textbox,但我想使用模型绑定

0 个答案:

没有答案