title: How to use ViewBag in Kendo Grid ClientTemplate's If condition
body: <p>I am loading some ids to a <code>ViewBag</code> to use it's data in the related View. </p>
  
  <pre><code>var userAccountList =serviceResponse.RoleList.Select(x =&gt; x.RoleId).ToList();
  ViewBag.UserRoles = userAccountList;
  </code></pre>
  
  <p>this result is a <code>List&lt;string&gt;</code>.</p>
  
  <p>In the View a Kendo Grid retrieves data from json. </p>
  
  <pre><code>@(Html.Kendo().Grid&lt;RoleModel&gt;().Name("KendoGrid").Scrollable().Columns(columns =&gt;
   {
          columns.Bound(x =&gt; x.Id)
              .HtmlAttributes(new { style = "text-align:center;"})
              .ClientTemplate("# if ( Id != '3'){
                  #&lt;a class='k-button' href=\"/Role/Delete/#= Id #\"&gt;&lt;span class='k-icon k-delete' style='pointer-events: none;'&gt;&lt;/span&gt;Delete&lt;/a&gt;# }#")
              .Width(85).Sortable(false)
              .Hidden(!((BaseController)this.ViewContext.Controller).UserHasPermission(PermissionType.RoleDelete));
          columns.Bound(x =&gt; x.Name);
  
  ....
   }
  </code></pre>
  
  <p>When I use static values such as <code>'3'</code> I could prevent to show <code>a</code> tag that was used as delete button. How can I use <code>ViewBag.UserRoles</code> in this conditional if the list contains <code>Id</code> that's bound to column?</p>