XMod allows you to extend the functionality of its browsing displays (lists and grids created with ListView templates).
Each plugin consists of one or more classes contained in a DLL. Your DLL must reference the primary XMod DLL (KnowBetter.XMod.dll) Each plugin class must implement the KnowBetter.XMod.Extensibility.Plugins.IViewPlugin interface.
The interface consists of several methods that are called when certain events occur while XMod is processing the display. Each method must implemented, though you can choose to ignore any of the events.
IViewPlugin Interface:
(DNN2)
ViewInit(pmc as DotNetNuke.PortalModuleControl, PlugInSettings as System.Collections.Specialized.NameValueCollection, ByRef DispSettings As Extensibility.PlugIns.DisplaySettings)
(DNN3)
ViewInit(pmc as DotNetNuke.Entities.Modules.PortalModuleBase, PlugInSettings as System.Collections.Specialized.NameValueCollection, ByRef DispSettings As Extensibility.PlugIns.DisplaySettings)
Called on each page load. This is called right after the plugin is created and passes the plugin important information for interacting with XMod including a reference to the DNN module object, a collection of the attributes in the plugin tag, and a special class that passes additional XMod information which, among other things, allows you hide/show Action menu items, change their caption.
ViewLoad(IsPostBack As Boolean)
Called on each page load - after ViewInit. Passes a variable which identifies whether this event is occurring after a page postback.
GridItemCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)
Called after a row has been created in a grid. Not called if the display is a list. At this point controls such as Edit/Approve/Delete links have been created, but they won't be fully processed until the DataBound event. You should not remove or change the links at this stage. Doing so may cause an error. XMod passes the DataGrid control in sender and additional information about the created item in e.
GridItemDataBound(sender as Object, e as System.Web.UI.WebControls.DataGridItemEventArgs, ByVal xmi As KnowBetter.XMod.InstanceData)
Called after data has been bound to a row in a grid. Not called if the display is a list. XMod passes the DataGrid control in sender, data related to the item in the data grid being bound, and an InstanceData object that represents the values of the record.
ListItemCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs)
Called after a row has been created in a list. Not called if the display is a grid. At this point controls such as Edit/Approve/Delete links have been created, but they won't be fully processed until the DataBound event. You should not remove or change the links at this stage. Doing so may cause an error. XMod passes the DataList control in sender and additional information about the created item in e.
ListItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs, ByVal xmi As KnowBetter.XMod.InstanceData)
Called after data has been bound to a row in a list. Not called if the display is a grid. XMod passes the DataList control in sender, data related to the item in the data list being bound, and an InstanceData object that represents the values of the record.
PageChanged(ByVal CurrentPage As Integer, ByVal PreviousPage As Integer, ByVal TotalPages As Integer)
Called when the Next or Previous page navigation links are clicked. By comparing CurrentPage and PreviousPage, you can determine if Next or Previous was clicked. If they are the same, you can tell if the navigation is at the beginning of the set (CurrentPage would be 1) or if you are at the end of the set (CurrentPage = TotalPages). This event is not called when the data is first bound to the list/grid.
ViewUnload()
Called when the form is unloaded. This is the perfect time to release any resources, etc.