我的代码是:
@(Html.Telerik().Grid<Model>()
.Name("TestGrid")
.ClientEvents(events =>
{
events.OnDataBound("validate");
events.OnDataBinding("onDataBinding");
})
.DataBinding(db => db.Ajax()
.Select("Action1", "Controller1", new { ldata, filter }).Enabled(true)
)
.Columns(c =>
{
c.Bound(ctl => ctl.Uname)
.ClientTemplate("<input type='radio' id='rdbutton'name='IsSelected'/>")
//.ClientTemplate("<input name='<#= UserName #>' type='radio' />")
.Title("").Filterable(false).Sortable(false).Width(5);
c.Bound(itm => itm.Fname).Title("FName").Width(200).HtmlAttributes(new { @style = "vertical-align: top !important;" });
c.Bound(itm => itm.LNAme).Title("Lname").Width(200).HtmlAttributes(new { @style = "vertical-align: top !important;" });
c.Bound(itm => itm.Location).Title("Location").Width(200).HtmlAttributes(new { @style = "vertical-align: top !important;" });
})
.Selectable()
.Sortable()
.Filterable()
.Pageable(pg =>
{
pg.PageSize(3);
})
)
列是绑定的,因为它们需要在搜索时检索值。