Razor with kendoui 文本编辑器
Razor with kendoui text editor
我试图在选中复选框时显示 Kendo UI 文本编辑器。
但是它不起作用,你能帮帮我吗..
@if (Model.IsAlert!=true)
{
<td>
@(Html.Kendo().Editor().Name("Explanation").HtmlAttributes(new { style = "display:show" }))
</td>
}
您当前的方法只会在初始加载屏幕时呈现 that/evaluate Model.IsAlert。
我建议删除 if 语句,并将此 td 默认隐藏,然后通过映射到您的复选框控件的 onChange 事件处理程序根据模型中的属性更改它。
<td id="thingToHide" hidden="hidden">
@(Html.Kendo().Editor().Name("Explanation").HtmlAttributes(new { style = "display:show" }))
</td>
和一些jquery代码:
<script type="text/javascript">
$(document).ready(function () { // On page load method, check model and show textbox if needed
var model = @Html.Raw(Json.Encode(Model)); // get model example is taken from
if (model.IsAlert) { // If model IsAlert is true, show Explanation field
$("#thingToHide").show();
}
});
$("#YourCheckBoxId").on("change", function() {
$("#thingToHide").toggle();
});
</script>
拉达祝你好运!
我试图在选中复选框时显示 Kendo UI 文本编辑器。
但是它不起作用,你能帮帮我吗..
@if (Model.IsAlert!=true)
{
<td>
@(Html.Kendo().Editor().Name("Explanation").HtmlAttributes(new { style = "display:show" }))
</td>
}
您当前的方法只会在初始加载屏幕时呈现 that/evaluate Model.IsAlert。
我建议删除 if 语句,并将此 td 默认隐藏,然后通过映射到您的复选框控件的 onChange 事件处理程序根据模型中的属性更改它。
<td id="thingToHide" hidden="hidden">
@(Html.Kendo().Editor().Name("Explanation").HtmlAttributes(new { style = "display:show" }))
</td>
和一些jquery代码:
<script type="text/javascript">
$(document).ready(function () { // On page load method, check model and show textbox if needed
var model = @Html.Raw(Json.Encode(Model)); // get model example is taken from
if (model.IsAlert) { // If model IsAlert is true, show Explanation field
$("#thingToHide").show();
}
});
$("#YourCheckBoxId").on("change", function() {
$("#thingToHide").toggle();
});
</script>
拉达祝你好运!