使用 Kendo 网格设置图像标签

Setting Image Tag using Kendo Grid

我对在 Kendo 网格中设置图像有疑问:

@(Html.Kendo().Grid(Model)
   .Name("grid")
   .Columns(columns =>
   {
       columns.Bound(x => x.AgencyID).Title("ID");
       columns.Bound(x => x.AgencyName).Title("Agency");
       columns.Bound(x => x.AgencyTrialStatus).Template(x =>
       {
             //How to append the img tag here ,also i want to check If the 
              AgencyTrialStatus is Active then I want to show an img tag in the grid.

       }


       columns.Bound(x => x.AgencyBillingStatus).Title("Billing");
       columns.Bound(x => x.CreatedDate).Title("FirstActivity").Format("{0:MM/dd/yyyy}");
       columns.Bound(x => x.LastUpdated).Title("LastActivity").Format("{0:MM/dd/yyyy}");
       columns.Bound(x => x.TrialEndDate).Title("TrailEnd").Format("{0:MM/dd/yyyy}");
       columns.Bound(x => x.NoOfTimeUserLogin).Title("# of Logins");
   })
           .Scrollable()
           .Groupable()
           .Sortable()
  )

我已经尝试过 clientTemplate,但找不到方法。

请帮忙提前谢谢!!

这可能对您有帮助:

              columns.Bound(x => x.AgencyTrialStatus).Title("Trail").Template(
            @<text>
                 @if (item.AgencyTrialStatus.ToString() == "Active")
                 {
                     <div class="text-center"><span class="btn-success" style="height: 16px; width: 20px; display: inline-block;margin-top: 5px; "></span></div>
                 }
                 else
                 {
                     <div class="text-center"><span class="btn-danger" style="height: 16px; width: 20px; display: inline-block; margin-top: 5px;"></span></div>
                 }

             </text>
              );

             </text>

您可以使用 div 的图片标签 编码愉快!!