columns.Bound(p => p.Active).ClientTemplate("\\#if('#=Active#'=='Y') {\\<input type='button' value='OK' />\\}\\#").Width(150).Title("Status");
但是条件被视为字符串??
#if('Y'=='Y')`enter code here` {
<input type="button" value="OK">
}#
columns.Bound(p => p.Active).ClientTemplate("\\#if('#=Active#'=='Y') {\\<input type='button' value='OK' />\\}\\#").Width(150).Title("Status");
但是条件被视为字符串??
#if('Y'=='Y')`enter code here` {
<input type="button" value="OK">
}#
在Kendo模板中,有三种使用哈希语法的方法:
#= #
#: #
# if(...){# ... #}#
因此,在您的代码中,您需要编写:
columns.Bound(p => p.Active).ClientTemplate(
"#if(Active=='Y') {#
<input type="button" value="OK">
#}#").Width(150).Title("Status");
在示例中,请注意#
符号如何分隔内部代码和外部代码。当您处于代码内部时,您不必再次使用#
来访问变量,这就是为什么Active之前可以没有#
的原因。
columns.Bound(p => p.Active).ClientTemplate(
"# if (IsServiceExist) { #" +
"<input type='button' value='OK' />"+
"# }#").Width(150).Title("Status");
我希望您能找到解决方案。以下是一些有关IT技术的内容:
columns.Bound(p => p.IsActive)
.ClientTemplate(
"\\# if (IsActive != false) { \\#" +
"\\<input type=\"checkbox\" id=\"checkBox\" class=\"parentCheckBox\" window-call=\"template\" checked/>\\" +
"\\# } else { \\#" +
"\\<input type=\"checkbox\" id=\"checkBox\" class=\"parentCheckBox\" window-call=\"template\" />\\" +
"#\\ } \\#")
.Width(10);
columns.Template(@<text></text>)
.ClientTemplate("#if (Field3 == true) {#"
+ "<a onclick='jsFoo(#=Id#)' href='\\#'></a> "
+ "#} #").Width(70).Title("ColA");
columns.Bound(searchModel => searchModel.Value).ClientTemplate(
"#if(Name=='DevboardTask'){# " +
"<a href='\\#UpdateStatusWindow' onclick=\"javascript:openflexpmtask('#=Value#');\">#=Value#</a> " +
"#} else {# " +
"<a\">#=Value#</a> " +
"#}#");
这可能会对你有所帮助。这只是一个例子...