1
我有以下的下降asp.net的MVC定下ASP.net MVC驗證問題
@Html.DropDownListFor(model => model.DataId, ((IEnumerable<ProgrammeModel>)ViewBag.Data).Select(option => new SelectListItem
{
Text = (option == null ? "None" : option.Name),
Value = option.DataId.ToString(),
Selected = (Model != null) && (option.DataId== Model.DataId)
}), "Choose...", new { Class = "input", id = "DataId"
})
,並在型號:
[Required(ErrorMessage="The Data field is required.")]
public int DataId { get; set; }
但是,當驗證發生在表單提交我是獲取此字段的錯誤消息爲
Int32字段是必需的。
在那裏我期待的結果作爲
數據字段需要
你能幫我嗎?
感謝, Ajai
不,它仍然沒有工作 – 2012-03-12 11:20:25
什麼是確切的錯誤,現在 – DKD 2012-03-13 06:26:36