【发布时间】:2014-03-04 12:53:15
【问题描述】:
错误:无法将 lambda 表达式转换为类型“字符串”,因为它不是委托类型
当我尝试在 mvc4 中添加 cshtml 页面时出现此错误。 在行
客户名称:@Html.TextBox(m => Model.CustomerName)
谁能解释它的含义以及它为什么出现在这里?代码是
@model DataEntryMvcApplication.Models.Customer
@using (Html.BeginForm())
{
<p>Customer Name: @Html.TextBox(m => Model.CustomerName)</p>
<p>ID:@Html.TextBox(m=>Model.CustomerId)</p>
<input type="submit" name="Custtomer" />
}
这是模型类;
namespace DataEntryMvcApplication.Models
{
public class Customer
{
public string CustomerId { get; set; }
public string CustomerName { get; set; }
}
}
【问题讨论】:
标签: asp.net-mvc-4