This question is locked. New answers and comments are not allowed.
I have a bug in the following code whereby the MVC telerik grid control is throwing a NotSupportedException on the .Selectable() method. I have checked this by commenting and uncommenting the code and the error only occurs when .selectable() is in the code.
@(Html.Telerik().Grid(Model).Name("Grid") .Columns(columns => { columns.Bound(o => o.ManagerID); columns.Bound(o => o.Title); columns.Template(@<label>@item.User.Forename @item.User.Surname</label>); columns.Template(@<label>Email <a href="mailto:@item.User.Email">@item.User.Forename @item.User.Surname</a></label>).Title("Email this manager"); columns.Template(@<label>@item.ManagerBranch.Count</label>).Title("Manager for no. Branches"); } ) .Scrollable(scrolling => scrolling.Enabled(true)) .Sortable(sorting => sorting.Enabled((bool)true)) .Pageable(paging => paging.Enabled((bool)true)) .Filterable(filtering => filtering.Enabled((bool)true)) .Groupable(grouping => grouping.Enabled((bool)true)) .Footer((bool)true) .Selectable() @* Error being caused by this method, strange thing is this code is an exact copy of another view there the code is working correctly.*@ .ClientEvents(click => click.OnRowSelected("onRowSelected")))Full Error:
NotSupportedException was unhandled by the user codeThe DataKeys collection is empty. Please specify a data key.Message : The DataKeys collection is empty. Please specify a data key.Source : Telerik.Web.MvcStacktrace : at Telerik.Web.Mvc.UI.Grid`1.VerifySettings() at Telerik.Web.Mvc.UI.ViewComponentBase.WriteHtml(HtmlTextWriter writer) at Telerik.Web.Mvc.UI.Grid`1.WriteHtml(HtmlTextWriter writer) at Telerik.Web.Mvc.UI.ViewComponentBase.ToHtmlString() at Telerik.Web.Mvc.UI.ViewComponentBuilderBase`2.ToHtmlString() at Telerik.Web.Mvc.{Dynamic}.GridBuilder`1\[\[TwistDataLayer.Manager\, TwistDataLayer\, Version=1.0.0.0\, Culture=neutral\, PublicKeyToken=null\]\].IHtmlString.ToHtmlString() at System.Web.HttpUtility.HtmlEncode(Object value) at System.Web.WebPages.WebPageBase.Write(Object value) at ASP._Page_Views_Manager_Index_cshtml.Execute() in c:\dev\Projects\twist\branches\development\AdminPortal\Views\Manager\Index.cshtml:line 10 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.StartPage.RunPage() at System.Web.WebPages.StartPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)