We are using MVC with Telerik component. In our case, we have a grid and with dynamic columns. In normal applications we access the column in code behind. But in MVC , shall we use server side code to access the particular columns. If it so, please give us sample code to access the particular columns.
The following are the code sample what we have used in our project,
<% Html.Telerik().Grid(Model.objStudentCollection)
.Name(
"ExamGrid")
.DataKeys(keys =>
{
keys.Add(p => p.StudentID);
})
.Pageable(p => p.PageSize(50))
.Scrollable(p => p.Height(500))
.Columns(columns =>
{
columns.Template(o =>
"<input type='checkbox' name='checkedRecords' value='<#= StudentID #>' />")
.Title(
"<input id='mastercheckbox' type='checkbox' />") // add checkbox to header
.HeaderHtmlAttributes(
new { style = "text-align:center;" })
.Width(50)
.HtmlAttributes(
new { style = "text-align:center;" });
columns.Bound(o => o.StudentID).Width(150).Title(
"ID");
columns.Bound(o => o.StudentName).Width(150).Title
(
"Name:");
columns.Bound(o=>o.SEmail).Width(150).Title("Email").Hidden();// Here want to hide Dynamically
})
.Pageable(paging => paging.PageSize(5))
.Selectable()
.Scrollable()
.Sortable(sort => sort.SortMode(
GridSortMode.MultipleColumn))
.Render();
%>
Regards
Dhandapani