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

"columns.Template" issue with dataBinding.Ajax()"

4 Answers 238 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.
Nim
Top achievements
Rank 1
Nim asked on 26 Jan 2011, 10:40 PM
Hello,

When I follow the documentation in my testings, I see an issue.

If I run the following:

    <%  
        Html.Telerik().Grid(recs)
                      .Name("records")
                      .Columns(columns =>
                      {
                          columns.Bound(rec => rec.id);
                          columns.Bound(rec => rec.name);

                          //Template column which shows an action link
                          columns.Template(o =>  {
                              %>
                                  <%= Html.ActionLink("Edit", "Home", new { id = o.id }) %>
                              <%  }).Title("Edit");
                      }).Pageable().Sortable().Render();
    %>

it works fine.  However, if I add:

.DataBinding(dataBinding => dataBinding.Ajax().Select("_AjaxBinding", "Home"))

the following error occurs:

"...Cannot use only server templates in Ajax or WebService binding mode. Please specify a client template as well..."

The cause seems to be "columns.Template", which cannot be used with Ajax together.

Is there any workaround?  Any plan to make "columns.Template" compatible with dataBinding.Ajax()?

Thank you!

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 26 Jan 2011, 11:15 PM
Hello Nim,

 Please check this section of the grid troubleshooting help article. Server template are never going to be supported for ajax binding because it occurs entirely on the client side and the browser does not know  how to run server (c#) code. The solution is to define a client template as well as the server one.

All the best,
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
Nim
Top achievements
Rank 1
answered on 27 Jan 2011, 04:42 PM
Hello,

Thank you for the reply.
Let me clarify my understanding of:

"....The solution is to define a client template as well as the server one...."

In one Grid control, if I use ajax binding (for columns.Bound(...).ClientTemplate), I won't be able to use the server template (columns.Template) at the same time because the server template are never going to be supported for ajax binding.  As a result, in order to define a client template as well as the server one, you are referring to creating two separate grids.  One will work without ajax at all for server template, and another one will work with ajax for client template.

Is my understanding correct?

Thank you!
0
Georgi Krustev
Telerik team
answered on 27 Jan 2011, 04:52 PM
Hello Nim,

 You just need to define both templates (server and client) in the same grid declaration. Thus when grid is initially rendered will show Server templates, because it uses server binding. Then on any other operation like paging, filtering and etc. grid will use client templates as it uses Ajax binding configuration.  

Regards,
Georgi Krustev
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
Nim
Top achievements
Rank 1
answered on 27 Jan 2011, 06:33 PM
Hello,

Thank you for your reply.
I think I just find out the answer that I need.
To use Template, ClientTemplate, and Ajax binding together, I need to write the column like:
       .Columns(columns =>
       {
          columns.Bound(o => o...)
                 .ClientTemplate("...")
                 .Template(o =>
                 { %>
                      ...
                   <%
                 });
       })



Tags
Grid
Asked by
Nim
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Nim
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or