Hide Kendo Grid Column based on condition in ASP.Net MVC

Last Reply one month ago By dharmendr

Posted one month ago

Below is my kendo grid

in this grid i need to hide Case Number column conditionally that means if (admin== true) i need to show this column or else i need to hide this column

how can i do this

              @(Html.Kendo().Grid(Model.GiIncidentReportList)
                  .Name("IRGrid")
                  .Columns(columns => {
                      columns.Bound(r => r.IncidentReport.IR_CaseNumber).Title("Case Number"); // hide Case Number column conditionally that means if(admin== true) i need to show this column or else i need to hide
                      columns.Bound(r => r.IncidentCreatedByName).Title("Created By");
                      columns.Bound(r => r.IncidentCreatedDateTime).Title("Created Date");
                      columns.Bound(r => r.IncidentUpdatedByName).Title("Updated By");
                      columns.Bound(r => r.IncidentUpdatedDateTime).Title("Updated Date");
                      columns.Template(p => @Html.ActionLink("Delete","DeleteIncidentReport","IncidentReport",
                          new { incidentReportId = p.IncidentReport.IR_IncidentID, dlLogId = p.IncidentReport.DL_LogID, incidentType = p.IncidentReport.IT_IncidentType }, 
                          new { @class = "k-button k-button-icontext", onclick = "return confirm('Are you sure you wish to delete this report?')" }).ToHtmlString());
                  })
              )

 

 

You are viewing reply posted by: dharmendr one month ago.