我的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,但我想使用模型绑定