We want to use 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 and this 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 found that sometimes jQuery can cause problems for DevExpress controls, so i tried removing all jQuery scripts, but that didn’t make a difference. Someone also suggested to put a callbackpanel around te gridview, but that didn’t work either. I have tried many more things (which i mostly forgot already) but nothing worked so far.
I have also asked the same question on the DevExpress website end the Orchard forums but i’m not getting any answers there, so i thought i’d try my luck here.
I have made an example project in case you want to see what i’m trying to do. The file is 40MB because i added the entire cms to itwith example daabase, including our module. The module is called GridViewTest You can find the source here:http://www.obec.nl/download/Orchard-DevExpress.zip.
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:
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.