前边我知道,括号里边的该怎么改
@Html.TextBox
@Html.ValidationMessage("Name", "*")
@Html.TextArea("Description", new { rows = "8", @class="textbox" })
<p>
<label for="Name">类别名称:</label>
<%= Html.TextBox("Name",null,new{@class="textbox"}) %>
<%= Html.ValidationMessage("Name", "*") %>
</p>
<p>
<label for="Description">类别说明:</label>
<%= Html.TextArea("Description", new { rows = "8", @class="textbox" })%>
</p>
@Html.TextBox
@Html.ValidationMessage("Name", "*")
@Html.TextArea("Description", new { rows = "8", @class="textbox" })
<p>
<label for="Name">类别名称:</label>
<%= Html.TextBox("Name",null,new{@class="textbox"}) %>
<%= Html.ValidationMessage("Name", "*") %>
</p>
<p>
<label for="Description">类别说明:</label>
<%= Html.TextArea("Description", new { rows = "8", @class="textbox" })%>
</p>
解决方案 »
- C#写的121行五子棋
- DataGridView 超级连接列问题,在线等!
- 帮我改一下修改密码的代码,在线等候
- 请教一个类的基本问题
- 找不到类型或命名空间名称“SequentialWorkflow
- 用vs.net2003打包MSDE的安装程序(2003系统环境开发)在2000系统和XP系统上可以安装,而在2000系统下却不能正确安装MSDE?!
- 为什么我从文件中读出来的鼠标光标是一块黑色的矩形???
- 水晶报表的问题:我写完程序后,在本机测试通过,在另外一台机器上安装时出现下面问题:
- 怎样在datagrid里面放置一个checkbox模板列,然后再用一个checkbox2来控制checkbox模板列
- C#控件 下载
- C#写的浮点或汉字转十六进制小工具 .
- XP操作系统32位机C#2005环境下开发的应用程序如何在WIN7 64位机器上运行?
前边一个是aspx的方式,是别人写的,我想改成纯的razor的方式
@model List<VideoCategories>
@{
ViewBag.Title = "NewAddCategory";
}
@using (Html.BeginForm())
{
<fieldset>
<legend>视频类别</legend>
<p>
<label for="Name">类别名称:</label>
@Html.TextBoxFor(Model => Model.Name, new { style = "width:80%", maxlength = "80" })
<%= Html.ValidationMessage("Name", "*") %>
</p>
<p>
<label for="Description">类别说明:</label>
@Html.TextAreaFor(a => a.Description, new { rows = "8" })
</p>
<p>
上级类别:@Html.CategoryDropdown(model, "ParentId", null, null, "—无—")
</p>
<p>
<label for="Display">是否显示:</label>
<%= Html.CheckBox("Display",true) %>
</p>
<p>
<input type="submit" value="保存(S)" accesskey="S" />
</p>
</fieldset>
}
显示错误如下错误 1 “System.Collections.Generic.List<Webtest.WebVOD.Models.VideoCategories>”不包含“Name”的定义,并且找不到可接受类型为“System.Collections.Generic.List<Webtest.WebVOD.Models.VideoCategories>”的第一个参数的扩展方法“Name”(是否缺少 using 指令或程序集引用?) f:\code\BYVOD\Views\Admin\NewAddCategory.cshtml 50 49 BYVOD
错误 2 “System.Collections.Generic.List<Webtest.WebVOD.Models.VideoCategories>”不包含“Description”的定义,并且找不到可接受类型为“System.Collections.Generic.List<Webtest.WebVOD.Models.VideoCategories>”的第一个参数的扩展方法“Description”(是否缺少 using 指令或程序集引用?) f:\code\BYVOD\Views\Admin\NewAddCategory.cshtml 55 42 BYVOD
错误 3 当前上下文中不存在名称“model” f:\code\BYVOD\Views\Admin\NewAddCategory.cshtml 58 41 BYVOD
你的View显然是对其中一条记录来的。如果你觉得必须这样,这么修改
Model => Model.Name
->
Model => Model[0].Name其余类似。