Here is an example:
@(Html.Kendo().Grid<MyViewModel>(Model.Records)
.Name("MyGrid")
.Columns(columns =>
{
columns.Bound(c => c.Price)
.HtmlAttributes(new { @class = "gridColumnPrice" })
.Title(UIResources.Price)
.HeaderHtmlAttributes(new { @class = "gridColumnPrice" });
})
.DataSource(c => c.Server()
)
This code generates JS as below:
jQuery(function(){jQuery("#MyGrid").kendoGrid({columns:[{title:"Price",attributes:{class:"gridColumnPrice"}, ............... ETC
In IE8 and older versions, you will get:
SCRIPT1028: Expected identifier, string or number lyKqsEz1h0Lo7AitxGa6wik1, line 2 character 208
This is because 'class' word in JS is not allowed as class property. You should add apostrophes around properties.
@(Html.Kendo().Grid<MyViewModel>(Model.Records)
.Name("MyGrid")
.Columns(columns =>
{
columns.Bound(c => c.Price)
.HtmlAttributes(new { @class = "gridColumnPrice" })
.Title(UIResources.Price)
.HeaderHtmlAttributes(new { @class = "gridColumnPrice" });
})
.DataSource(c => c.Server()
)
This code generates JS as below:
jQuery(function(){jQuery("#MyGrid").kendoGrid({columns:[{title:"Price",attributes:{class:"gridColumnPrice"}, ............... ETC
In IE8 and older versions, you will get:
SCRIPT1028: Expected identifier, string or number lyKqsEz1h0Lo7AitxGa6wik1, line 2 character 208
This is because 'class' word in JS is not allowed as class property. You should add apostrophes around properties.