我有一个列(医学诊断)列表。该列表在控制器中用方法填充。我需要检查新添加的诊断是否在网格列表中(并且只允许添加列表中的诊断)。网格使用模板:
@(Html.Kendo().AutoCompleteFor(model => model)
.Name("ICD10Code")
.Placeholder(RunStrings.TypeICD10CM)
.MinLength(3)
.Delay(300)
.DataTextField("DisplayText")
.DataSource(source =>
source.Read(read =>
read.Action("GetDiagnosisList", "Run", new { area = "ECLS" })
.Data("onAdditionalData")
)
.ServerFiltering(true)
)
.Events(e => { e.Change("onChange"); })
.HtmlAttributes(new { title = RunStrings.TypeICD10CMDescription })
)我想为JavaScript事件编写onChange代码,检查新诊断是否在列表中。我需要一个AJAX调用来进行验证。
发布于 2016-04-05 06:36:19
您必须在脚本中创建一个函数onChange,并在其中使用ajax调用,如下所示。
$.ajax({
type: "POST",
url: '@Url.Action("write here the actin result name","controller name")',
dataType: "json",
contentType: "application/json; charset=utf-8",
data: the data which you want to pass using JSON.stringify
})https://stackoverflow.com/questions/36345610
复制相似问题