This is a migrated thread and some comments may be shown as answers.

[Solved] Grid ClientTemplate Workaround Problem

6 Answers 981 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nate
Top achievements
Rank 1
Nate asked on 16 Apr 2010, 03:08 PM
Can anybody tell me what i did wrong in this ClientTemplate workaround recommendation i used for Ajax Binding? It is throwing the

NotSupportedException.



<% Html.Telerik().Grid(Model.URoleViewModel.Group)
                       .Name("UnAssignedRoleGrid")
                       .DataBinding(dataBinding => dataBinding.Ajax().Select("SelectedUser", "UserAdministration", new {userName = ViewData["userName"],roleAction = "Add"}))
                       .Columns(columns => {
                           columns.Bound(r => r.RoleName).Template(r =>
                               {
                                   %>
                                   <%=Html.ActionLink("Edit", "AddRemoveRoles", new { roleName = r.RoleName, roleAction = "Add"})%>
                                   <%
                               })
                           .ClientTemplate("<a href='" + Url.Action("AddRemoveRoles", "UserAdministration") + "/<#= RoleName #>Edit</a>").Title("Edit");
                           columns.Bound(r => r.RoleName).Width(170);
                           columns.Bound(r => r.RoleDesc).Width(170);
                       })
                           .Scrollable()
                           .Pageable()
                           .Render();
                    %>             

Thanks,

Netsanet

6 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 16 Apr 2010, 03:16 PM
Hi Netsanet Gizaw,

This workaround is for assembly version 2010.1.416 and newer. In earlier versions you have to use ClientTemplate only. I am attaching it to this thread.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Nate
Top achievements
Rank 1
answered on 16 Apr 2010, 03:22 PM
Hi Atanas,

Thanks for your quick response!
But i have problems when i use the ClientTemplate only too............Instead of the checkbox i see the value is displayed. Any idea?

<% Html.Telerik().Grid(Model.URoleViewModel.Group)
                       .Name("UnAssignedRoleGrid")
                       .DataBinding(dataBinding => dataBinding.Ajax().Select("SelectedUser", "UserAdministration", new {userName = ViewData["userName"],roleAction = "Add"}))
                       .Columns(columns => {
                           columns.Bound(r => r.RoleName).ClientTemplate("<input type='checkbox' name='checkedRecords' value='<#= RoleName #>' />").Title("Check").Width(50).HtmlAttributes(new {style = "text-align:center"});
                           columns.Bound(r => r.RoleName).Width(170);
                           columns.Bound(r => r.RoleDesc).Width(170);
                       })
                           .Scrollable()
                           .Pageable()
                           .Render();
                    %>


Netsanet
0
Accepted
Atanas Korchev
Telerik team
answered on 16 Apr 2010, 03:41 PM
Hi Netsanet Gizaw,

You have specified the datasource which means the grid is initially bound server side. Client templates are not applied in this case. You have two options:

  1. Upgrade to the version attached in my previous reply (recommended)
  2. Do not server-bind the grid:
    Use
    <% Html.Telerik().Grid<MyType>()
    Instead of
    <% Html.Telerik().Grid(Model.URoleViewModel.Group)

Kind regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Nate
Top achievements
Rank 1
answered on 16 Apr 2010, 03:49 PM
Atanas you rock!!!!!!!!!!!!
0
RE
Top achievements
Rank 1
answered on 04 Jun 2010, 02:11 PM
Thx, solved my problem!
0
Matthew Reily
Top achievements
Rank 1
answered on 18 Nov 2010, 10:38 PM
Do you think you guys could add a note in your demo descriptions that recommends not to use the "server bind" method?  I spent a couple hours banging my head and looking at the documentation before I found this thread.
Tags
Grid
Asked by
Nate
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Nate
Top achievements
Rank 1
RE
Top achievements
Rank 1
Matthew Reily
Top achievements
Rank 1
Share this question
or