DNN Navigation Redirect With Parameters and No Control 

 

When working with DotNetNuke I often find it necessary to do a redirection back to the current page, with additional querystring parameters.  Not actually switching views, but just back to the same page so that some other action could be taken for a specific module.  In the past most of the examples I found used this process.

DotNetNuke.Common.Globals.NavigateUrl(this.TabId) + "?mykey=myvalue"

Which would create a url such as

http://www.mysite.com/MyFolder/Default.aspx?mykey=myvalue

Although a fully functional URL that works 100%, it is not something that can be easily copied, and overall doesn't look all that fancy.  Looking through the functionality of the various NavigateUrl overloads, it didn't seem apparent that there was something that could be used to re-write that type of URL.  Well I missed something using the following code.

DotNetNuke.Common.Globals.NavigateUrl(this.TabId, "", "mykey=myvalue")

From this example we provide the tabId, a blank ControlKey, and then our added parameter value.  We could add additional parameters as well.

This results in a URL similar to the following.

http://www.mysite.com/MyFolder/mykey/myvalue/Default.aspx

Now, this is a fully re-written URL, and something much easier for a person to remember.  I hope this has been helpful!

Posted by Mitchel on Monday, June 08, 2009
 

Comments

Mitchel,

Actually I prefer to use the ParamArray method and pass each variable/value pair a SEPARATE parameter... like this:

NavigateURL(TabId, "", "ParamName1", "ParamValue1", "ParamName2", "ParamValue2") ...

This way I also don't have to worry about properly constructing the string, especially considering that most of the times the Parameter Values are actually local variables.

I hope this makes sense, and is helpful to other implementing the NavigateURL function.

Cheers!

By Antonio Chagoury on Tuesday, June 09, 2009 at 6:49 PM

Is there a way to display the control page with the existing modules and layout that the calling page has?

The problem is a I have a List view with a buttonLink. The button link creates a navigateURL that goes to a page that just
has the Details module but nothing else.

How can I have it display with all the modules that the ListView page has?

By Rod Merritt on Wednesday, July 08, 2009 at 1:50 PM

Rod,

You have to manage the toggling views in your module. The key is that you cannot use a different ControlKey for the view

By mitchel.sellers@gmail.com on Wednesday, July 08, 2009 at 1:58 PM

Hi. Great stuff. I actually stumbled upon your blog accidentally but was amazed by its content. The information was really good and i would love to come back often. So I have given link to your blog from my blog. Same thing is expected from your side for good colleboration & mutual gain.

By iiuniveadds on Monday, July 27, 2009 at 7:03 AM

Just needed this clarification! Thanks a ton!

By RamS on Tuesday, April 12, 2011 at 1:50 AM

Name (required)

Email (required)

Website

CAPTCHA image
Enter the code shown above:

Content provided in this blog is provided "AS-IS" and the information should be used at your own discretion.  The thoughts and opinions expressed are the personal thoughts of Mitchel Sellers and do not reflect the opinions of his employer.

Friend of RedGate

www.datasprings.com - DotNetNuke ModulesICG

Click here for advertising information.

Content in this blog is copyright protected.  Re-publishing on other websites is allowed as long as proper credit and backlink to the article is provided.  Any other re-publishing or distribution of this content is prohibited without written permission from Mitchel Sellers.