我想在kendo ui gridview Nopcommerce中添加if条件

时间:2018-05-29 10:00:08

标签: asp.net-mvc razor kendo-grid nopcommerce-3.90

enter image description here

{
                                        field: "Id",
                                        title: "@T("Admin.Common.Download")",
                                        width: 100,
                                        headerAttributes: { style: "text-align:center" },
                                        attributes: { style: "text-align:center" },
                                        template: '<a class="btn btn-default" href="DownloadPdf/?downloadGuid=#=downloadGuid#" title="Download" ><i class="fa fa-download" aria-hidden="true"></i></a>'
                                    }
如果downloadGuid不为空,我需要模板部分中的

,否则将显示“下载”图标。

1 个答案:

答案 0 :(得分:1)

如果我们想在kendo网格中添加If else条件,我们想要在条件之前和之后添加#。

template: '#if (downloadGuid!=null) { #<a class="btn btn-default" href="DownloadPdf/?downloadGuid=#=downloadGuid#" title="Download" ><i class="fa fa-download" aria-hidden="true"></i></a> # }#'