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

[Solved] Is it possible to combine MVC Panel and MVC Grid?

5 Answers 153 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.
Luke
Top achievements
Rank 1
Luke asked on 17 Nov 2009, 06:44 PM
Is it possible to combine the two controls in a single view?

I am using databinding to create a set of panels, and using ajax with a single, parameterised action method to get each panel's content on demand, content for a panel being rendered in a partial view.  This works fine provided I use 'plain' Html to display the panel content, but if I try to use an MVC grid to display the content it breaks - I get a javascript "method not supported" error, the grid body renders correctly but the pager bar renders 'vertically', and clicking on another page displays the grid unformatted in a new separate page.

5 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 18 Nov 2009, 02:26 PM
Hi Luke,

The problem comes from the inability of MicrosoftAjax.js to evaluate Javascript code. Hence the grid's JS code is not loaded on the page, after the grid is rendered. To avoid this behavior you will need to include grid.js file explicitly on the page where the panelbar is rendered. Here is a code snippet showing  what I mean:
<%= Html.Telerik().ScriptRegistrar()
                   .DefaultGroup(group => group.Add("telerik.common.js").Add("telerik.grid.js"))%>
It is recommended to place the ScriptRegistrar on the end of the master page.

Regards,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Luke
Top achievements
Rank 1
answered on 19 Nov 2009, 12:48 PM
Unfortunately it's not that simple.  I already have a ScriptRegistrar on my master page; I can't add one to any other pages without getting an error about calling Render more than once (which makes sense).

I can't find a way of building a databound set of panels that use grids to show their content.  I get the javascript error and a broken grid pager.  Even with hard-coded panels the grid's pager doesn't render correctly.  See attached screenshot.

I can provide a copy of my evaluation solution to illustrate the problem if that'll help.
0
Georgi Krustev
Telerik team
answered on 19 Nov 2009, 02:42 PM
Hi Luke,

It is hard to determine where could be the problem depending on the given information. I will suggest you open regular support ticket and related with this thread. Thus you will be to attach a fully working test project which replicates the problem. Hence I will review it locally and advice you further.

Sincerely yours,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Luke
Top achievements
Rank 1
answered on 19 Nov 2009, 04:14 PM
I've raised a ticket as "General Feedback - Product".  Ticket ID is: 260294  As I only have a licence for RadControls for Ajax I don't have the Beta licence for MVC, so can't raise a support issue directly against the MVC product. 
0
Georgi Krustev
Telerik team
answered on 23 Nov 2009, 08:58 AM
Hi Luke,

Here is a quote of the answer:

Hello Luke,

Thank you for the attached test project.

The cause of the JS error is a result of the inability of the MiscrosoftAjax.js to evaluate JavaScript code. To overcome this issue, as I mentioned in the forum thread, you should add the grid.js and grid.filtering.js files with ScriptRegistrar. The Scriptregistrar should be outside of the partial view (preferable at the end of the master page).

The problem with grid pager is caused of the overriding of some styles of the grid by those of the panelbar. This is expected, because of the paradigm of the primitives. Unfortunately we will not support this case for now. One possible solution is to place the grid CSS styles before the panelbar's ones in the telerik.common.css file. With this action at least the grid's pager will be in one row.

For your convenience I have attached the modified test project.


Greetings,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Luke
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Luke
Top achievements
Rank 1
Share this question
or