or
<div style="width:830px;font-size:x-small; padding-top:40px;"> @(Html.Kendo().Grid<SystemsFormsMVC.Models.vMyForm>() .Name("Grid1") .Columns(columns=> { columns.Bound(o => o.Id); columns.Bound(o => o.SystemName); columns.Bound(o => o.FormType); }) .DataSource(dataSource => dataSource .Ajax() .PageSize(5) .Read(read => read.Action("GetMyForms", "Home")) ) .Pageable() .Navigatable() .Sortable() .Filterable() )</div>public ActionResult GetMyForms([DataSourceRequest] DataSourceRequest request){ var query = _repository.GetMyForms(GetCurrentUserName()); query = query.OrderBy(s => s.RequestDate); return Json(query, JsonRequestBehavior.AllowGet);} public IQueryable<vMyForm> GetMyForms(string UserName){ SystemsFormsDataContext db = new SystemsFormsDataContext(); IQueryable<vMyForm> query; Int32 UserId = GetCurrentUserId(UserName); try { query = (from s in db.vMyForms where s.UserId == UserId select s); } catch (Exception ex) { query = (from s in db.vMyForms where s.UserId == 0 select s); } return query;}<div class="form-group"> @Html.Label("User Role(s)") @{ (Html.Kendo().MultiSelectFor(model => model.SelectedRoles) .Name("SelectedRoles") .HtmlAttributes(new {style = "width: 400px"}) .Placeholder("Please select role(s)...") .DataTextField("Name") .DataValueField("Id") .DataSource(source => { source.Read(read => { read.Url("/api/gmcmembership/roles").Type(HttpVerbs.Get); }); }) .Value(Model.SelectedRoles) .AutoBind(false) ).Render(); }</div>using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;namespace GMCWebApplication.Areas.admin.Models{ public class UserDetailViewModel { [HiddenInput] public string Id { get; set; } public int CompanyCode { get; set; } public string UserType { get; set; } public int Question1 { get; set; } public int Question2 { get; set; } public string Question1Answer { get; set; } public string Question2Answer { get; set; }// public string PasswordHash { get; set; } public string PhoneNumber { get; set; } public string NewPassword { get; set; } public List<UserRoleViewModel> SelectedRoles { get; set; } public List<UserRoleViewModel> AllRoles { get; set; } }}using System;using System.Collections.Generic;using System.Linq;using System.Web;namespace GMCWebApplication.Areas.admin.Models{ public class UserRoleViewModel { public string Id { get; set; } public string Name { get; set; } }}[System.Web.Http.HttpGet][System.Web.Http.Route("roles")]public IHttpActionResult GetRoles(){ try { var list = new List<UserRoleViewModel>(); using (var context = new ApplicationDbContext()) { list = context.Roles.Select(p => new UserRoleViewModel { Id = p.Id, Name = p.Name }) .ToList<UserRoleViewModel>(); } return Ok(list); } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); return InternalServerError(); }}