开发者

Serial Number For Telerik Grid in MVC

开发者 https://www.devze.com 2022-12-29 09:09 出处:网络
I开发者_运维技巧 need to add a column to telerik grid which shows the serials number Please Help.. ThanksYou can use a bound column if the serial number is a regular property exposed by the object the

I开发者_运维技巧 need to add a column to telerik grid which shows the serials number Please Help.. Thanks


You can use a bound column if the serial number is a regular property exposed by the object the grid is bound to:

<%= Html.Telerik().Grid<MyObject>()
        .Name("MyGrid")
        .Columns(columns =>
        {
           columns.Bound(o => o.SerialNumber);
        });
%>

If you need some custom formatting applied you can define a template for that column:

<%  Html.Telerik().Grid<MyObject>()
        .Name("MyGrid")
        .Columns(columns =>
        {
           columns.Bound(o => o.SerialNumber).Template(o =>
           {
             %>
               <strong><%= o.SerialNumber %></strong>
             <%
           });
        })
        .Render();
%>

And finally if you are using ajax or web service binding and need customization - use the ClientTemplate:

 <%  Html.Telerik().Grid<MyObject>()
            .Name("MyGrid")
            .Columns(columns =>
            {
               columns.Bound(o => o.SerialNumber)
                      .ClientTemplate("<strong><#= SerialNumber #></strong>");
            })
            .Render();
    %>
0

精彩评论

暂无评论...
验证码 换一张
取 消