日期:2014-05-17 浏览次数:20451 次
<tr>
<td width="15%">
标题:
</td>
<td colspan="3">@Html.TextBoxFor(a => a.Title, new { style = "width:80%", maxlength = "80" })
@Html.ValidationMessageFor(a => a.Title)
</td>
</tr>
<tr>
<td width="15%">
分类:
</td>
<td width="35%">
@Html.DropDownListFor( a => a.TypeId,(SelectList) ViewData["TypeId"],"—传达范围—")
@Html.ValidationMessageFor(a => a.TypeId)
</td>
</tr>
[MetadataType(typeof(TaskMD))]
public partial class Task
{
}
public class TaskMD
{
[Required(ErrorMessage = "必须选择类型")]
public int TypeId { get; set; }
[Required(ErrorMessage = "必须设置【任务名称】")]
public string Title { get; set; }
}