我的 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 记录具有价值。我可以使用 Html.textbox 但我想使用模型绑定