- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我已经为我的 MVC View 实现了必需的验证。文本控件显示验证消息,但剑道组合框不显示。我正在做一个ajax回发。
组合框不显示消息的任何原因?工作类型组合是强制性的,但它不显示验证消息。
查看
@using (Ajax.BeginForm("ActivityWorkLog_Create", "Activity", new AjaxOptions
{
HttpMethod = "POST",
OnSuccess = "OnWorklogStatusSuccess",
OnFailure = "OnWorklogStatusFailure"
}, new { id = "workLogForm" }))
{
<div class="k-popup-edit-form k-window-content k-content" data-role="window">
<div class="k-edit-form-container">
@Html.HiddenFor(x => x.RequestID, new { data_bind = "value: requestId" })
@Html.HiddenFor(x => x.ActivityID, new { data_bind = "value: activityId" })
@Html.HiddenFor(x => x.CountryCode, new { data_bind = "value: countryCode" })
<div class="form-group">
<div class="editor-label">
@Html.LabelFor(model => model.WorkLogAppliesToName)
</div>
<div class="editor-field">
@(Html.Kendo().ComboBoxFor(model => model.WorkLogAppliesToName)
.Name("WorkLogAppliesToID")
.Filter("contains")
.HtmlAttributes(new { style = "width:300px", @readonly = "readonly" })
.Placeholder("Select...")
.DataTextField("WorkLogAppliesToName")
.DataValueField("WorkLogAppliesToID")
.DataSource(dataSource => dataSource
.Read(read => read.Action("GetWorkLogAppliesTo", "WorkLog", new { id = 0 }).Type(HttpVerbs.Post)
)
)
)
@Html.ValidationMessageFor(model => model.WorkLogAppliesToName, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="editor-label">
@Html.LabelFor(model => model.ActivitySLA)
</div>
<div class="editor-field">
@*@Html.EditorFor(model => model.ActivitySLA)*@
@Html.TextBoxFor(model => model.ActivitySLA, new { id = "ActivityDesc", @readonly = "readonly", Class = "textBoxFor" })
</div>
</div>
<div class="form-group">
<div class="editor-label">
@Html.LabelFor(model => model.ActivityID)
</div>
<div class="editor-field">
@(Html.Kendo().ComboBoxFor(model => model.ActivityID)
.Name("Activity")
.Filter("contains")
.HtmlAttributes(new { style = "width:300px", @readonly = "readonly" })
.Placeholder("Select...")
.DataTextField("Description")
.DataValueField("ActivityID")
.DataSource(dataSource => dataSource
.Read(read => read.Action("GetActivity", "WorkLog").Data("additionalActivityInfo").Type(HttpVerbs.Post)
)//.ServerFiltering(true)
)//.CascadeFrom("ServiceID").Filter("contains")
)
@Html.ValidationMessageFor(model => model.ServiceID, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="editor-label">
@Html.LabelFor(model => model.WorkLogType)
</div>
<div class="editor-field">
@(Html.Kendo().ComboBoxFor(model => model.WorkLogTypeCode)
.Name("WorkLogTypeCode1")
.Filter("contains")
.HtmlAttributes(new { style = "width:300px"})
.Placeholder("Select...")
.DataTextField("WorkLogType")
.DataValueField("WorkLogTypeCode")
.DataSource(dataSource => dataSource
.Read(read => read.Action("GetWorkLogType", "WorkLog").Data("additionalWLTInfo").Type(HttpVerbs.Post))
)
)
@Html.ValidationMessageFor(model => model.WorkLogTypeCode, "Please select a worklog type", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="editor-label">
@Html.LabelFor(model => model.WorkLogSubject)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.WorkLogSubject)
@Html.ValidationMessageFor(model => model.WorkLogSubject, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="editor-label">
@Html.LabelFor(model => model.WorkLogDetails)
</div>
<div class="editor-field">
@Html.TextAreaFor(model => model.WorkLogDetails, new { htmlAttributes = new { @class = "form-control", cols = "50" } })
@Html.ValidationMessageFor(model => model.WorkLogDetails, "", new { @class = "text-danger" })
</div>
</div>
<div class="worklogStatusButtonAlign">
<button id="btnWorkLogSave" type="submit" class="k-button k-button-icontext k-primary k-grid-update">Save</button>
<button id="btnClose" type="button" class="k-button k-button-icontext k-grid-cancel">Cancel</button>
</div>
<div id="worklogStatusMessage"> </div>
</div>
</div>
}
Javascript
<script>
$(document).ready(function () {
var form = $("#workLogForm")
.removeData("validator")
.removeData("unobtrusiveValidation");
$.validator.unobtrusive.parse(form);
});
查看模型
public class ActivityWorkLogViewModel
{
[ScaffoldColumn(false)]
[Display(Name = "WorkLogID", ResourceType = typeof(Resources.Resource))]
public int WorkLogID { get; set; }
[Required(ErrorMessage = "WorkLogType is required")]
[Display(Name = "WorkLogTypeCode", ResourceType = typeof(Resources.Resource))]
public string WorkLogTypeCode { get; set; }
[Display(Name = "WorkLogType", ResourceType = typeof(Resources.Resource))]
public string WorkLogType { get; set; }
[Required]
[Display(Name = "WorkLogAppliesToID", ResourceType = typeof(Resources.Resource))]
public int WorkLogAppliesToID { get; set; }
[Display(Name = "WorkLogAppliesToName", ResourceType = typeof(Resources.Resource))]
public string WorkLogAppliesToName { get; set; }
[Required]
[Display(Name = "RequestID", ResourceType = typeof(Resources.Resource))]
public int RequestID { get; set; }
[Display(Name = "ServiceID", ResourceType = typeof(Resources.Resource))]
public Nullable<int> ServiceID { get; set; }
[Display(Name = "ActivityID", ResourceType = typeof(Resources.Resource))]
public Nullable<int> ActivityID { get; set; }
[Required(ErrorMessage = "Subject is required")]
[Display(Name = "WorkLogSubject", ResourceType = typeof(Resources.Resource))]
public string WorkLogSubject { get; set; }
[Required(ErrorMessage = "Details is required")]
[Display(Name = "WorkLogDetails", ResourceType = typeof(Resources.Resource))]
public string WorkLogDetails { get; set; }
[Display(Name = "EmailTo", ResourceType = typeof(Resources.Resource))]
public string EmailTo { get; set; }
[Display(Name = "IsActive", ResourceType = typeof(Resources.Resource))]
public bool IsActive { get; set; }
[Display(Name = "CountryCode", ResourceType = typeof(Resources.Resource))]
public string CountryCode { get; set; }
[Display(Name = "ActivitySLA", ResourceType = typeof(Resources.Resource))]
public string ActivitySLA { get; set; }
}
最佳答案
尝试添加这个:
<script>
$(function () {
$("form").kendoValidator();
});
</script>
和/或:
<script>
$.validator.setDefaults({
ignore: ""
});
</script>
关于c# - Kendo Combobox 未触发所需的验证消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44072259/
我有一个依赖于包 B 的包 A。当包 A 中的代码运行并访问包 B 中的类时,包 B 的状态将被解析 (4),而不是 Activity (32) 和包 B 的激活器也没跑好。我认为 bundle B
这个问题在这里已经有了答案: How to remove the space between inline/inline-block elements? (41 个回答) 关闭 7 年前。
我正在尝试使用 Java OpenAL 库。我在导入名为 libsoft_oal.so 的 native 库时遇到问题。 Java OpenAL 依赖于 OpenAL 软实现。我尝试根据他们在 git
我正在尝试启动我的应用程序。是一个 unicorn +工头+sinatra的应用。 这是我的 config.ru 文件: require "rubygems" require "sinatra" Bu
我有一个下拉列表,其中包含一些从数据库表中检索的值,我想要的是当单击按钮时它应该只获得选项标签的中间值,但只有那些类名为“get_this”的选项标签并离开那些选项,如果他们没有这个类 预期输出:值
我有一个index.php文件,需要一个通用的head.php文件,head.php文件中有几个Javascript文件,当这样尝试时,代码在源代码中看起来很好,但文件却不是实际上对文档做任何事情。
有人能帮帮我吗? 我已经像这样运行了 imsmod: $ insmod /data/mm/mmdev.ko epoll_rate=100 但是我得到一个错误: insmod: init_module
是否有键盘快捷键或插件可以在 Notepad++ 中打开 PHP 所需或包含的文件?我知道,在 Dreamweaver 中,执行此操作的命令是 Ctrl+D,但我似乎无法在 Notepad++ 中找到
我已经用 js 设置了一个显示/隐藏 div,但我很难弄清楚如何一次显示一个 div。目前发生的情况是,除非我再次单击原始链接来关闭该 div,否则每个 div 都会显示。 http://www.li
当我尝试将未分配的辅助分片分配给节点时出现错误。 { "error": { "root_cause": [ { "type": "remote_transpor
我正在构建一个 C++ 应用程序,使用 Netbeans 6.9 作为我的 IDE。我有一个 C++ 库,它是一个纯 C 库的包装器。 我已将文件正确添加到项目中(使用添加库文件选项)。这是 g++
我是一名优秀的程序员,十分优秀!