Below are the steps to do so:
- Add a new control to your module, to do so go to
Host Menu >> Module Definition >> Edit module by clicking pencil icon on left
- On clicking “Add Module Control”, you will get a screen as below
- Enter a key; this will serve as id when you will like to traverse to this control from some other control.
- Select control from drop down list (of course the control needs to already exist in modules folder which in turn is under desktop modules folder). Things will look somewhat like below image.
- Adding a new landing control
- Edit your previous landing control by editing it and assigning it a control key.
At this point of time if you will visit any page with this module added, you will get a blank page as there is no specified landing control for your module.
- Now add a new control in similar way as above with just a single difference. This time you don’t have to assign the control query. A control with no control key serves as a landing page.
- Now its all set, put up your required logic on controls and access your newly added controls. To access these, you can use below code snippet
hlnkNewView.NavigateUrl = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "newView", "mid=" + ModuleId.ToString());
o You can find Globals.NavigateURL under DotNetNuke.Common class.
o First parameter of NavigateURL method is TabId of current page.
o Second parameter is control id given by us ("newView" in our case here).
o Third parameter is moduleId of current module.
Here hlnkNewView is an ASP Hyperlink control; you can use some other also ;)
This is all that needs to be done for having more than one view/edit controls in a single custom DNN Module.
Apart from this approach you can use ASP.NET MultiView control to manage multiple views. Rafe Kemmis has a great post about it at Managing Views In Your DotNetNuke Module
Apart from this approach you can use ASP.NET MultiView control to manage multiple views. Rafe Kemmis has a great post about it at Managing Views In Your DotNetNuke Module