Home » DotNetNuke - Module Development » DotNetNuke – Modules – Linking within the module

DotNetNuke – Modules – Linking within the module

OLYMPUS DIGITAL CAMERA         Now that we have the module skeleton up and running and we have a data access layer, the next thing we need to look at is specific functions you may need to use from within your code. One of the most useful functions is Globals.NavigateURL(). This is particularly useful if you want to generate a hyperlink back to the same page you are on. But with some additional code that we’ll introduce later, you can also use this to generate a hyperlink to another page.

Globals.NavigateURL() is located in the DotNetNuke.Common namespace. You’ll need to make sure that namespace is in whatever class you call this function from. Globals is the class name and NavigateURL is a static method with ten different overloads.

This simply provides a URL back to the page you are on. This is typically used from the Edit controls so that you can link back to the view that the edit control was originally on.

NavigateURL(int TabID)
This generates the URL to the page specified by TabId. In the early days of DNN, a page was a Tab on the navigation. TabId has kind of stuck ever since.

NavigateURL(string ControlKey)
If you need to generate a URL back to a specific control in the module (Edit or some other custom key), you can use this to generate that URL.

NavigateURL(int TabID, bool IsSuperTab)
The IsSuperTab parameter adds the PortalID to the URL if it is set to true.

NavigateURL(int TabID, string ControlKey)
This should be obvious. It creates a URL that leads to the page represented by TabID and the control represented by ConrolKey.

NavigateURL(string ControlKey, params string[] AdditionalParameters)
Next to NavigateURL(int TabID), this is probably the most useful form of this method. If you need to pass parameters into the page you are calling, this is the method you need. Using this function, you can do something like this:

string[] items = {"itemid=24"}; 

Which will call back to the page you are on with itemid=24 as the parameter/value.

You can also use:

NavigateURL(int TabID, string ControlKey, params string[] AdditionalParameters)
if you need to call another page with parameters.

The three other overloads are similar to what I’ve already shown. The only additional parameter you need to be aware of is PortalSettings which, as far as I know, is only used internally. Don’t worry about it.


Other post in DotNetNuke - Module Development

Like this Article? Subscribe to get every article sent to your email.

Related Post

  • DotNetNuke Modules – Creating Base ModulesDotNetNuke Modules – Creating Base Modules Now that we have DotNetNuke installed into Visual Studio we can go ahead and create our first modules. Actually, creating the modules is pretty simple. But it is even easier to do it […]
  • DotNetNuke Modules – Where Stuff Shows UpDotNetNuke Modules – Where Stuff Shows Up We continue our series on creating DotNetNuke modules today by showing you where the various components of the module we created last week show up in DotNetNuke.Remember, last […]
  • DotNetNuke Modules – Registering Your ModuleDotNetNuke Modules – Registering Your Module Yesterday, we used the DotNetNuke template to create a skeleton module and it's supporting files. Today, we want to get those modules registered into our Visual Studio copy of DotNetNuke […]
  • DotNetNuke Modules – Labels w/ no HelpDotNetNuke Modules – Labels w/ no Help While the bulk of the labels you use on a module will be DotNetNuke labels, occasionally you want to be able to put text on the screen that doesn't need context help and doesn't need to be […]
  • DotNetNuke Modules – LinkButtonsDotNetNuke Modules – LinkButtons As you can probably already guess, localizing a LinkButton in DotNetNuke is pretty straightforward. But you'll never guess what most people miss when they add this little control to their […]

About Dave Bush

Dave Bush is a Full Stack ASP.NET developer. His commitment to quality through test driven development, vast knowledge of C#, HTML, CSS and JavaScript as well as his ability to mentor younger programmers and his passion for Agile/Scrum as defined by the Agile Manifesto and the Scrum Alliance will certainly be an asset to your organization.