This project is read-only.

Using DevExpress Grid in Orchard as a custom module

Topics: Customizing Orchard
Feb 19, 2015 at 1:37 PM
Hello All,

We are trying to build a data extraction module that will have a data grid control from devexpress and the grid would be configurable in sense that we could allow it to connect to another database and run pre defined stored procedures. My question is on the approach do I build this as a custom module which would have its own settings page where the Admin can provide the settings or do I build this is a custom content part that can be embedded into a content type and the data grid content part has the settings where we can define the connections.
Please let me know.
Feb 19, 2015 at 2:33 PM
I would go for the second option, just create a part and attach to content type.
You can add your c# business logic in the driver (which is like a mini controller) or use content handlers to hook up code.
You can also have custom settings at the part level where the admin can set the config options for the grid.
see here.
You dont need to use site settings , you will be widening the scope of your function for no specific reason.
Feb 19, 2015 at 2:38 PM
Thanks Giannik so just to confirm you are suggesting the approach of creating a custom content part that can have custom settings to define the connections. So this would give me the flexibility to creating mutiple instances of the content part into various content types correct. Example Below:
  1. I have content type salary records for which I can attach my Grid Content Part which will connect to the datasource 1
  2. I can have another content type called sales forecast which I can attach my Grid Content Part which will connect to the datasource 2
Feb 19, 2015 at 3:37 PM
make the datasource property a configurable setting at the part level.
Then after you attach the part to the content type goto the admin for content type and expand the settings panel from the ui admin and set the value for the datrasource property value for each content type (which i assume would be some sort of connection string).
Then you can access the value set from your part driver or view using :

var typeSettings = part.Settings.GetModel<MyDataSourceSetting>();