views:

423

answers:

1

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);
+2  A: 

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.

Hope this helps!

codemypantsoff
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
Thanks yourself I had forgotten about that solution myself - yes that one is very viable as well
codemypantsoff