DNN Custom Forms by OnyakTech
OnyakTech Custom Forms DNN Module
by OnyakTech

Custom Forms DNN Extension: Plugin Development

You can develop your own plugins for the OnyakTech Forms DNN module to extend the current capabilities. The source code for the plugins included with the Forms module are available on OnyakTech.com in the Members Area on the My Downloads page, you can use the source of these plugins as a starting point for your own plugins.

Plugins are stored in the folder "DesktopModules\OnyakTechForms\plugins" off the root of your DNN web site. To add new plugins to your site, copy the user interface files to this folder and the Dll's to your sites Bin folder. When your site runs these plugins are automatically loaded into the OnyakTech Forms module. Note that there are four types of Plugin types (Controls, Filters, Search and Lifecycle Event), copy your plugin to the correct plugin type folder with it's own folder name that matches the control plugin. For example, the "Data Grid" search plugin included with the Forms module for DNN is located in the folder "\DesktopModules\OnyakTechForms\plugins\Search\DataGrid".

Plugin Types

Form Control: This plugin type renders as a form control on your form to create new controls you can use in your custom forms for DNN.

Filter: A Filter Plugin is used when form values are loaded and submitted. All values on the form are passed through your plugin allowing you to alter the values during specific points of the form lifecycle.

Life Cycle Event: A Life Cycle Event Plugin is executed during specific stages of your form. Currently these plugin types are still in development and will be completed with the roll-out of Forms Workflow.

Search: A Search Plugin passes the form values submitted to your plugin and renders a search results view below the form. See the Search Plugin included with the OnyakTech Forms module for examples of this in your DNN web site.

Plugin Components

Plugin Manifest: Each plugin requires an XML document that defines the plugin. This is required and the name of the manifest must follow the standard naming convenction of PluginNamePlugin.xml. As an example, the Data Grid Search plugin XML document is named DataGridPlugin.xml.



            	<description>Default Data Grid for the OnyakTech Forms Search</description>
            		<control name="Edit" value="DefaultGridEdit.ascx" />
            		<control name="Display" value="DefaultGridView.ascx" />



View Control: This is an ASP.Net User Control named using the standard PluginNameView.ascx. Example: DataGridView.ascx

Edit control: This is an ASP.Net User Control named using the standard PluginNameEdit.ascx. Exmaple: DataGridEdit.ascx

Settings Class: The settings class of your plugin inherits from the PlugInSettings class and is used to proxy plugin settings between your plugin and the Forms module.

Plugin Class: Each plugin is required to have a primary plugin class that inherits from the plugin type base class. If it's a search plugin the it should inherit from the ContentSearch class. Life cycle plugins inherit from the LifeCycleEvent class. Filter plugins inherit from the ContentFilter class. Control plugins inherit from the FormControl plugin class.

Plugin View

Displaying Messages: You can add information to the Forms Debug Log by adding them to the PluginLog.

             PluginLog.Add("Data Grid Search Loaded", "Data Grid Search Plugin");


Events: Each plugin type have several events you can trigger. The Search Plugin type includes the events LogUserActivity(), DownloadResultsToPDF(), DownloadResultsToExcel(), etc.

            override protected void OnInit(EventArgs e)
                // Use Control State instead of ViewState just in case
                // the ViewState is disabled which will break this plugin.
                lnkExport.Click += lnkExport_Click;
                PluginLog.Add("Data Grid Search Loaded", "Data Grid Search Plugin");
            protected void lnkExport_Click(object sender, EventArgs e)


Loading Settings:

                DataGridSettings settings = new DataGridSettings(pluginSettings);
                        _dataGridInfo.TableName = settings.TableName;
                        _dataGridInfo.ConnectionString = settings.ConnectionString;
                        _dataGridInfo.RowClickTemplate = settings.RowClickTemplate;


Plugin Edit

Base Class: The Plugin Edit user control inhertis from PlugInProviderControlBase and must contain a property declaration for DataSource().

             public partial class DefaultGridEdit : PlugInProviderControlBase
                public override object DataSource
                        // Store and return the settings
                        DataGridSettings settings = new DataGridSettings();
                        if (txtDirectMainSearch.IsNotNull())
                            settings.DirectMainSearch = txtDirectMainSearch.Text;                
                        if (txtDirectPrimaryKey.IsNotNull())
                            settings.DirectPrimaryKey = txtDirectPrimaryKey.Text;
                            settings.ReturnLimit = "-1";
                        base.DataSource = settings.ToString();
                        return base.DataSource;
                        if (value.IsNull()) return;
                        base.DataSource = value;
                        if (base.DataSource != null)
                            string pluginSettings = base.DataSource as string;
                            if (pluginSettings != null)
                                DataGridSettings settings = new DataGridSettings(pluginSettings);
                                if (txtDirectPrimaryKey.IsNotNull())
                                    txtDirectPrimaryKey.Text = settings.DirectPrimaryKey;
                                if (txtDirectMainSearch.IsNotNull())
                                    txtDirectMainSearch.Text = settings.DirectMainSearch;                      
Plugin Settings

Base Class: Inherits from PlugInSettings.

Details: This can be a standard data object class that does nothing more than contain the properties of the settings you will store for your plugin. It should have two constructors, one that does not contain parameters and another that passes a string to init the plugin using the XML string passed into the constructor. Calling the FromString(parm) will populate the settings for you.

         public sealed class DataGridSettings : PlugInSettings
		        public DataGridSettings()
                public DataGridSettings(string xml)