0
votes

Any DNN developers out there who have figured this out? I have a user control (ascx) (DotNetNuke extension) with 4 user controls. There are buttons on the first view form to access the others. When you access another control, you can access other controls from that control. I'm looking for the best way to redirect the user back to the previous control the user was on regardless of the 'level' of the control.

Here's an example.

1) First view form: People list

Buttons available:

2) User Addresses 3) User Downloads 4) User Videos 5) Another user related module

Let's say I choose 2) User Addresses

On that user control I have buttons to 3, 4 and 5

If I want to return to the first view control (1), I simply use DotNetNuke.Nvigation.NavigateURL and pass in the parameter of the user I was querying about. That works fine.

But now instead of going back to 1 I choose to go to 3) User Downloads When the user hits the 'Return' button to go to the previous screen (not the browser back button; this is a button on my form) I want to go back to 2) User Addresses, not back to the first view control (1).

I've tried adding the first view control as another control in the same extension, and using EditURL to call it, but the screen shows up blank on redirect (except for the DNN menu etc).

How do I redirect a user to the previous control, not the first control of the module?

If this doesn't make sense, let me know and I'll try to explain it better.

Thanks.

3

3 Answers

0
votes

You likely will want to pass a querystring parameter in the request to the various controls so that you can keep track of where they were, and how to get back.

Example:

Instead of just calling ctl=controlvalue try calling ctl=controlvalue&prevvalue=edit

THen you can wire up your Return code to use the querystring value of "prevvalue"

Chris

0
votes

Check out my DNNHero.com video tutorials on Module Views, Settings & Navigation. I give code and instruction on different ways of doing module view navigation.

0
votes

I decided to write a custom solution for this. It works really well, but it's a bit involved.

1) I wrote a SourceType enum to list the different forms in my application.

2) Any page can serve as the 'base page." On form load I read a property in settings for "base page url" and if it's not there yet, I write the base page's rawurl to the setting along with the enum value of which form (SourceType) it is.

3) Since sub-controls all use the same settings as the base page, whenever navigation occurs, I pass in the base page's enum value to the new form; in the new form I read the base page URL in the Page_Load of the new form and, if the current form's enum value is different from the enum value passed in (which it is), I use that base URL for the link 'back'.

4) If the user goes to another form from the second form, the process is repeated. But I pass both 'prevous' form enums to the third form so it shows two links to choose from to return to.

5) This can be repated as long as possible. One caveat: you have to remove the current form from the SourceType enum before you pass the SourceForms property back to a previous form; if you don't do this, the form you are coming from will also be listed as a 'go back to' form which you don't want.

Hope this helps someone having trouble figuring out a clean DNN redirection solution within multiple controls in a module.

If this isn't clear hit me up and I'll show some of my code.