Now I tried to solve the problem in a few hours, and I'm going to refuse ...
I am using MVC 3 grid control from Telerik. In my grid, I want the selected dropdownlists to match the user role. The drop-down list contains all user roles.
@(Html.Telerik().Grid(Model) .Name("Grid").TableHtmlAttributes(new { width="800"}) .Columns(columns => { //if (userIsInWhateverRole){ // columns.Template(o => Html.Action(GenerateYourLinkStuffHere)); //} columns.Bound(o => o.Name).Width(150); columns.Bound(o => o.Email).Width(120); columns.Template( @<text> @Html.DropDownList(item.Role, (IEnumerable<SelectListItem>)item.Roles) @Html.DropDownListFor(x => item.Role, (IEnumerable<SelectListItem>)item.Roles) </text> ).Width(120); }) .Sortable() .Scrollable() .Groupable() .Filterable() .Pageable(paging => paging.PageSize(5)) )
source share