Telerik Grid ASP.NET MVC 2.0 Selectable Issue
-
08-10-2019 - |
Question
I am trying to use a telerik grid in my view which is located in an administration area. Currently when I create views in the root level and use telerik grids, the grid properties such as, selectable(), work fine. When I do this in my administration area, the grid is rendered but the properties (such as .selectable()) do not work. I believe it is a referencing issue as my telerik scripts are located in the root level of the project in a 'scripts' folder and the corresponding css is located in the root level as well under a 'content' folder. The following is a snippet of my broken code:
<% Html.Telerik().Grid<Ability>()
.Name("Role Abilities Grid")
.BindTo((IEnumerable<Ability>) Model)
.DataKeys(k => k.Add(a => a.AbilityId))
.Columns(c =>
{
c.Bound(a => a.AbilityId).Width(45);
})
.Scrollable( scroll => scroll.Enabled(true))
.Selectable()
.Render();
Html.Telerik().ScriptRegistrar() %>
Any help would be appreciated. Thanks!
Solution
Ok Here's what was wrong, the grid .Name contained white spaces and needed to be space-less
<% Html.Telerik().Grid<Ability>()
.Name("RoleAbilitiesGrid")
.BindTo((IEnumerable<Ability>) Model)
.DataKeys(k => k.Add(a => a.AbilityId))
.Columns(c =>
{
c.Bound(a => a.AbilityId).Width(45);
})
.Scrollable( scroll => scroll.Enabled(true))
.Selectable()
.Render();
Html.Telerik().ScriptRegistrar() %>
Now it works correctly!