1
votes

I have a custom module in DNN 7 that has a data structure where items belong to categories (called "sections", not DNN taxonomy, just a simple list of section names). The module edit screens work so that on the view control you may click on an edit link on each category, which loads the category edit screen (passing the category id). This works great, and when you save I use Globals.NavigateURL() to return to the view screen. This all works as intended.

On each category edit screen I also have a list of the items within that category, each with an edit link. Clicking the edit link opens the item edit screen, passing the correct item id, and allowing me to edit that item. This all works great, until you save. The save works properly, but when I want to send the user back to the edit screen for the category it doesn't work. When I use:

Response.Redirect(EditUrl("SectionId", sectionid.ToString(), "EditSections"), true);

...nothing happens. It simply doesn't redirect anywhere. This is exactly the same URL I'm using to get to the category edit page in the first place:

EditUrl("SectionId", Eval("SectionId").ToString(), "EditSections")

And then I use a similar URL to get to the item edit page:

EditUrl("ItemId", Eval("ItemId").ToString(), "EditItems")

I don't understand why using the same URL to navigate to the same page I already navigated to would simply not do anything. For now I am sending them all the way back to the view, but it's painful if you need to add several items to the same category to have to navigate back into the category and add another item, only to be sent back to the view.

Anyone see anything like this before?

2

2 Answers

1
votes

Have you tried to use the overload of NavigateUrl instead of EditUrl?

Globals.NavigateURL(TabId, "EditSections", "mid", ModuleId.ToString(), "SectionId", Eval("SectionId").ToString())
0
votes

I haven't seen that myself but I would have to assume that somehow the context is being lost with EditURL and you're not getting sent to the proper location due to that.

I would suggest you try one of two things (or both).

  1. Debug the URL that EditURL is returning and see if you can find the difference.
  2. Use NavigateURL for all your links and pass in MID=## for your moduleid as a querystring parameter, to ensure that the proper values are being passed.

UPDATE: If you're trying to have multiple edit views, and move between them, you might look at using a "loader" instead of having separate module definitions for the edit controls. Basically have a single Edit.ascx file defined, and it loads other ASCX files within it, injecting into a Panel. The View control on this module http://dnnsimplearticle.codeplex.com/ does that, but I haven't tried it with an edit control before.