I have a datagrid of numbers that I format as a number, but if the number if 0 or null, I want don't want anything displayed.
How do I do this with KendoUI?
Also is there an easier way to make all numbers align to the right rather than injecting a style for the column?
Here is the grid that I am using:
@(Html.Kendo().Grid<KendoWithChart.Models.Report_Result>()
.Name("grid")
.BindTo((IEnumerable<KendoWithChart.Models.Report_Result>)ViewBag.SomeData)
.Columns(columns =>
{
columns.Bound(p => p.DESCRIPTION).Title("Description").ClientTemplate("# if( DESCRIPTION == 'Total IP') { # <strong>#: DESCRIPTION#</strong> # } else if( DESCRIPTION == 'Target Blended Liability') { # <strong>#: DESCRIPTION #</strong> # } else { # #: DESCRIPTION # # } #");
columns.Bound(p => p.DV01).Format("{0:n}").HtmlAttributes(new { style = "text-align:right" });
})
.Sortable() // Enable sorting
.DataSource(dataSource => dataSource.Ajax()
.Group(group => group.Add(p => p.Type))
.ServerOperation(false)
)
)
How do I do this with KendoUI?
Also is there an easier way to make all numbers align to the right rather than injecting a style for the column?
Here is the grid that I am using:
@(Html.Kendo().Grid<KendoWithChart.Models.Report_Result>()
.Name("grid")
.BindTo((IEnumerable<KendoWithChart.Models.Report_Result>)ViewBag.SomeData)
.Columns(columns =>
{
columns.Bound(p => p.DESCRIPTION).Title("Description").ClientTemplate("# if( DESCRIPTION == 'Total IP') { # <strong>#: DESCRIPTION#</strong> # } else if( DESCRIPTION == 'Target Blended Liability') { # <strong>#: DESCRIPTION #</strong> # } else { # #: DESCRIPTION # # } #");
columns.Bound(p => p.DV01).Format("{0:n}").HtmlAttributes(new { style = "text-align:right" });
})
.Sortable() // Enable sorting
.DataSource(dataSource => dataSource.Ajax()
.Group(group => group.Add(p => p.Type))
.ServerOperation(false)
)
)