问题描述
我正在我的ASP.NET Core MVC应用程序中使用免费的Kendo UI Core for jQuery(不是MVC)。
我有一个带有Kendo下拉列表的视图,并想为其修复客户端验证。
Create.cshtml:
<div class="form-group">
<label asp-for="UserProfile" class="control-label"></label>
<select id="UserProfileField" asp-for="UserProfileId" asp-items="ViewBag.UserProfileId" class="form-control" style="width: 100%"></select>
<span asp-validation-for="UserProfileId" class="text-danger"></span>
</div>
<script>
$(document.ready(function(){
$("#UserProfileField").kendoDropDownList({
optionLabel: "-- Benutzerprofil auswählen --",}).data("kendoDropDownList").select(0);
}));
</script>
现在,如果选择了选项标签(默认),我可以提交表单,并且服务器端验证失败。我使用jQuery Unobtrusive Validation,该方法适用于除Kendo dropdownlist元素之外的所有输入。当使用“,”而不是“。”时,我还有CustomValidation.js用于浮点数的小数点分隔符问题。
https://github.com/dotnet/aspnetcore/issues/6566
我不知道是否还添加我不熟悉的Kendo验证程序是一种解决方案,如果可以,它将再次破坏我的十进制分隔符吗?
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
<script src="~/js/CustomValidation.js"></script>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)