10

OK I'm new to DotNetNuke and need to write a simple module in DNN that will display an article for everyone, and allow the admin to edit the article/add a new one.

I have a test page that contains a DNN module with one module definition and two controls in that definition. The default control shows the article based on an articleID field in the querystring. You then click a button that is supposed to load the edit control and pass the articleID in the query string.

If I use EditURL() in the onClick the edit control is loaded with the correct articleID, but using the admin skin. If I use Globals.NavigateURL() then the correct skin is shown but my edit control isn't loading in the page.

Any clue as to how to what I'm doing wrong or how to get the edit control loading with the correct skin?

My two methods of switching to the edit control (in my button click event) are listed below:

string newURL = this.EditUrl("articleID", Request.QueryString["articleID"], "EditArticle");

        Response.Redirect(newURL);

and

        string newURL = Globals.NavigateURL(this.TabId, "EditArticle","articleID="+Request.QueryString["articleID"]);

        Response.Redirect(newURL);
ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
hotbot86
  • 243
  • 1
  • 5
  • 12
  • 3
    For more information on how this works, you can checkout my blog on the subject: http://weblogs.asp.net/briandukes/archive/2009/01/21/understanding-module-isolation-in-dnn.aspx. Ultimately, for your situation where you want to navigate to an edit control without using the admin skin, take a look at options two through four on Michael Washington's "Module Navigation Options" at http://adefwebserver.com/dotnetnukehelp/Misc/ModuleNavigationOptions.htm. – bdukes Dec 16 '09 at 03:56
  • Thank you for these links, they are very helpful and the DynamicControlsPlaceholder control is, I think, the way to go for future customer facing modules. – hotbot86 Dec 16 '09 at 14:43

1 Answers1

5

Actually you are doing this correctly - the editurl in DNN does load the Admin skin - usually this skin is based on someone administering content so it strips out all other modules and shows the 'basics'. Right or wrong this is what it does.

If you dont want to to do that you could provide a switch in the querystring and show a seperate panel or do a multiview control and show different views based on the switch in the query string.

There are a few other approaches like changing the content area to editing text area with ajax or using popup modal style windows.

Brian Webster
  • 30,033
  • 48
  • 152
  • 225
braindice
  • 988
  • 5
  • 16
  • Thanks. I suppose for my current needs this is acceptable behavior as only admins would be seeing this screen. For future modules that have several customer facing controls, I think the best method would be to do the dynamic loading of controls through a DynamicControlsPlaceholder as linked by bdukes above. – hotbot86 Dec 16 '09 at 14:42
  • Thanks yourself I had forgotten about that solution myself - yes that one is very viable as well – braindice Dec 16 '09 at 14:45