Ticket Q408486
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

When do DevExpress MVC support Orchard Project module?

DevExpress MVCxGridView in Orchard module - Callbacks don't work

created 13 years ago

Hello,

We want to use the cms Orchard for a website. We are creating a custom module/widget for that cms and in that module we want to use a GridView from DevExpress to show data. We got most of it working, but we can't get callbacks to work. With that i mean things like navigating through pages, sorting rows and moving columns.

If we look in the console we can see that the javascript and ajax callbacks are never executed, we can't figure out why that is so. I have found some topics on the DevExpress site about using DevExpress with Orchard, but i couldn't find anything usefull (for my case) in those. We also noticed that the methods of our controller are never called, but cannot figure out why not.

I have made an example project. The file is 40MB because i added the entire cms to it, including our module. The module is called GridViewTest, you can find it in the modules directory of the Orchard.sln solution. You can find the source here: http://www.obec.nl/download/Orchard-DevExpress.zip.

I hope someone can help me figure out what the problem is, because i'd really like to use DevExpress in Orchard.

Answers

created 13 years ago (modified 13 years ago)

Hello,

I have finally found a solution. It turned out to be a pretty simple one (like usual) and i want to share it here, in case other people want to use DevExpress with Orchard:

In your Orchard module, you have to create a Routes.cs file (in the root of the module). There you have to add this:

C#
using System.Collections.Generic; using System.Web.Mvc; using System.Web.Routing; using Orchard.Mvc.Routes; namespace CentralStationDataView { public class Routes : IRouteProvider { public void GetRoutes(ICollection<RouteDescriptor> routes) { foreach (var routeDescriptor in this.GetRoutes()) { routes.Add(routeDescriptor); } } public IEnumerable<RouteDescriptor> GetRoutes() { return new[] { new RouteDescriptor { Priority = 5, Route = new Route( "AreaName", new RouteValueDictionary { { "area", "AreaName" }, { "controller", "ControllerName" }, { "action", "ActionName" } }, new RouteValueDictionary(), new RouteValueDictionary { { "area", "AreaName" } }, new MvcRouteHandler()) } }; } } }

You can make the AreaName up as you like, it doesn't matter (as far as i know) what you call it. Make sure that you don't add the "Controller" suffix to the ControllerName.
Then, in your GridView settings you have to add this:
settings.CallbackRouteValues = new { area = "AreaName", Controller = "ControllerName", Action = "ViewDataPartial" };
These values have to all be exactly the same as the values in the Routes.cs file. The "area" property was critical for me, i already had the Routes.cs file and everything, but i didn;t add the area property to the CallbackRouteValues.

The second part of the solution is that you have to make a partial view with only and i stress, only, the GridView inside it. So no scripts, no extra html elements, no text, nothing.

    Comments (1)
    DevExpress Support Team 13 years ago

      Obec,
      Thank you for sharing your solution with us. I believe it will be helpful for other users!

      created 13 years ago (modified 13 years ago)

      Hello Obec,
      It seems that the same theme was discussed in the 'When do DevExpress MVC support Orchard Project module?' thread. We do not support Orchard projects.

        Comments (2)

          Hello,
          I already ran across that topic. I thought i posted my question on the forums, to see if any other DevExpress user has tried it to use DevExpress with Orchard and maybe they could help me then. But it seems that this got posted in the support center, or is it both the same now?
          I can never find my way in this new DevExpress site, i liked the old one better. The old one also looked more professional and was more user friendly.

          DevExpress Support Team 13 years ago

            Obec,
            I have changed the MVC product to General. According to the new SC2 concept, the General product is used for a conversation between customers. Thus, other people can share their experience with you.

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.