Search code examples
dotnetnuke

How to add control to the module


I've seen a few examples but they are outdated. I'm using standard template for module creation with View, Edit, Setting.

I'm adding a new control TestPage : MyModuleBase in mymodule.dnn

<moduleControl>
<controlKey>TestPage</controlKey>
<controlSrc>DesktopModules/mymodule/TestPage.ascx</controlSrc>
<supportsPartialRendering>False</supportsPartialRendering>
<controlTitle>TestPage.ascx</controlTitle>
<controlType>Edit</controlType>
<iconFile />
<helpUrl />
<viewOrder>0</viewOrder>
</moduleControl>

then on View on button click:

this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabId, "TestPage"));

and it redirects to /mymodule/ctl/TestPage/portalid/0 and it is empty. What is wrong in my settings?


Solution

  • You have to use EditURL instead of NavigateURL in order to specify you want to load a specific control for the module that the moduleID is specified in the URL.