条件语句嵌入客户端模板剑道UI MVC网格(服务器) [英] Conditionals embedded in client templates in kendo ui MVC grid (server)

查看:148
本文介绍了条件语句嵌入客户端模板剑道UI MVC网格(服务器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

内的剑道格,我想显示一个链接,用户如果管理者不分配, 其他显示管理器的已分配的名称。为管理员可以为空,我有成功,得到该链接,只显示当经理不为空。 但问题是,如果管理者不为空如何diaplay在其他部分经理的名字

下面是客户端模板,我试图使用方法:

  @(Html.Kendo()。网格(模型)
 。名称(网格)
 .Columns(列=>
 {
     columns.Bound(O => o.AccountManager).title伪(客户经理)
    .ClientTemplate(#如果(的AccountManager == NULL){#+ @ Html.ActionLink(分配,行动,控制器,新{@caseId =#= CaseID#,@tabIndex =0 },{新@Title =查看})。ToHtmlString()+#}其他{#+如何dispaly这里的客户经理的值+#}#)。HtmlAttributes(新{@style =文本对齐:中心});
 })
 

解决方案

解决it.this可以帮助其他面临同样的问题。

  @(Html.Kendo()。网格(模型)
。名称(网格)
.Columns(列=>
{
  columns.Bound(O => o.AccountManager)。.title伪(客户经理)ClientTemplate(#如果(的AccountManager == NULL){#+ @ Html.ActionLink(分配,行动,控制器,新{@caseId =#= CaseID#,@tabIndex =0},{新@Title =查看})。ToHtmlString()+#}其他{#+#=的AccountManager #+#}#)HtmlAttributes(新{@style =文本对齐:中心});
})
 

Inside a Kendo Grid, I'd like to display a link to the user if manager is not assigned , else display the name of manager already assigned . as the manager can be null, I'm having success getting this link to only show when the manager is not null. but problem is if manager is not null how to diaplay the manager name in else part

Below is the client template I'm trying to use:

@(Html.Kendo().Grid(Model)    
 .Name("Grid")
 .Columns(columns =>
 {
     columns.Bound(o => o.AccountManager).Title("Account Manager")
    .ClientTemplate("# if (AccountManager == null) { #" + @Html.ActionLink("Assign", "action", "Controller", new { @caseId = "#=CaseID#", @tabIndex = "0" }, new { @Title = "View"}).ToHtmlString() + "# }else {#" + "how to dispaly value of account manager here" + "#} #").HtmlAttributes(new {@style = "text-align:center" });  
 })       

解决方案

Solved it.this may help others facing same problem

@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
  columns.Bound(o => o.AccountManager).Title("Account Manager").ClientTemplate("# if (AccountManager == null) { #" + @Html.ActionLink("Assign", "action", "Controller", new { @caseId = "#=CaseID#", @tabIndex = "0" }, new { @Title = "View"}).ToHtmlString() + "# }else {#" +  "#=AccountManager#" + "#} #").HtmlAttributes(new {@style = "text-align:center" });  
})

这篇关于条件语句嵌入客户端模板剑道UI MVC网格(服务器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆