I want to add if condition in kendo ui gridview Nopcommerce

217 views Asked by At

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>'
                                    }

in template section I need if downloadGuid is not empty then Download icon will show otherwise not.

1

There are 1 answers

0
Arun Solanki On

If we want to add If else condition in kendo grid we want to add # before and after condition.

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> # }#'