ASP.NET-DataTables in Dotnetnuke
After signing off from that little endeavor, I decided to try DataTables with Dotnetnuke. Service Framework was introduced in Dotnetnuke (DNN) v6.2, it was MVC based thing, but later in v7 they have changed it and now it uses ASP.NET WebApi framework
In the previous post we covered how to write WebApi for DataTables; now to use that WebApi Controller in DNN; we need to inherit our controller from DnnApiController instead. We also need another class implementing DNN's IServiceRouteMapper to register routes for our WebApi with its Service Framework. By this approach, we no longer need to add any code in DNN’s Global.asax for route regisration. Dotnetnuke has its own convention and way for route registering as shown in the figure below. Basically you tell the Module’s “Folder Name” and namespaces where DNN tries to find relevant Controller. The URL becomes ~/DesktopModules/Your-Folder-Name/API/ and your route pattern.
Once everything is in place, we can start using DataTables. My observation is that DNN doesn't load your DLL and it expect its already loaded, so if you try to test your controller directly with browser or fiddler calls your requests might end up with 404s. If there is ASCX in your DLL its better to access the page first indirectly it will load your DLL and then you will be fine testing your controller with browser or fiddler.
Given Silverlight is no longer supported in latest versions of Chrome and Microsoft Edge, this can be a good framework to replace user interfaces that might had been made with Silverlight DataGrid! Happy migrations!
If your table has many rows and you are using GET with your web api; you might expereince 404 errors; it can be due to long URL being requested as datatables send column configurations as the Query String values. To resolve it; either use POST or increate allowed URL length using following configuration in web.config
<httpRuntime maxUrlLength="40960" maxQueryStringLength="2097151" />
<requestLimits maxUrl="40960" maxQueryString="2097151" />