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

Blending Server and Client Templates for Paging - Razor

2 Answers 127 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.
Reid
Top achievements
Rank 2
Reid asked on 15 May 2012, 11:34 PM

Hi All,

I have a grid working in a razor template that shows four levels of expansion. Right now it is all Server bound and working fine.

My goal now is two add the Ajax calls for the Payments grid to allow the user to Page records without a Postback for the entire page.  Which does not work because the user loses their place as the page loads again.

The error I got by just adding the Ajax DataBinding declaration was "NotSupportedException: "Cannot use only server templates in Ajax or WebService binding mode. Please specify a client template as well."

Looking at this link  http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-grid-troubleshooting.html#ClientTemplates it seems to demonstrate that you drop in the client template beside the server.Template.

The view I am building uses Razor @helper methods to render the grids.  That takes place passing in the WebViewPage, and the data from the parent grid using the DetailViiew().  So I have modified the working view (see attached .cshtml) here to add (or try to add) the .ClientTemplate() code.



The error now is ...  " Cannot convert lambda expression to type 'string' because it is not a delegate type", the offending line is the @<text> line in the client template.

Is this the right approach?  Do we need to provide a client template for each column?  And can someone help with formatting here? The intellisense seems to like it at design time.

Any help would be appreciated.

Thanks,
Reid

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 18 May 2012, 02:58 PM
Hi Reid,

The "Not Supprted Exception" will be thrown when using a Server Detail Template for an Ajax bound Grid. You should specify a ClientTemplate for the detail instead in order to avoid it. Also, the Razor text tag cannot be used in a ClientTemplate as it is an action and a string is expected. The Ajax Hierarchy and Client Detail Template demos shows how should the template look like.
 
Greetings,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Reid
Top achievements
Rank 2
answered on 22 May 2012, 10:46 PM
Hi Daniel,

I have since returned to an all client model.  Thanks for your help in this thread and others concerning this view I am working on.

Reid
Tags
Grid
Asked by
Reid
Top achievements
Rank 2
Answers by
Daniel
Telerik team
Reid
Top achievements
Rank 2
Share this question
or