我在项目中使用kendo complete for MVC。
我有一些表单中的国家列表,我显示国家名称,但存储国家代码。
我遇到了以下问题:当用户输入不在列表中的内容时,该值将被发送到服务器。如何避免这种情况并发送空值(表示未选择任何值)?
以下是我的代码:
@Html.Kendo()
.ComboBoxFor(model => model.CountryCode)
.BindTo(ViewBag.Countries as IEnumerable<SelectListItem>)
.Filter(FilterType.StartsWith)
.Placeholder("Country")
.HtmlAttributes(new { @class = "span9" })