2
votes

I have a problem with modules that uses multiple ascx-files. when loading the module all looks fine, the correct skin is loaded but when i navigate to an different ascx file within the module the skin changes to admin skin and i canĀ“t get around it.

i need all of the ascx files with viewtype: "view" to get the portalskin not the default adminskin. is there away to get around this? please help!

1

1 Answers

1
votes

The way I choose to get around this is to have my module do the loading of the ASCX files instead of letting DNN do it with the various ControlKey parameters.

My DnnSimpleArticle module is a good example of how to do this http://dnnsimplearticle.codeplex.com/

Basically the View.ascx file consists of a Placeholder

<asp:PlaceHolder ID="phViewControl" runat="server" />

The codebehind for that control does the loading

try
{
    var controlToLoad = "Controls/ArticleList.ascx";
    if (ArticleId > 0)
    {
        controlToLoad = "Controls/ArticleView.ascx";
    }

    var mbl = (dnnsimplearticleModuleBase)LoadControl(controlToLoad);
    mbl.ModuleConfiguration = ModuleConfiguration;
    mbl.ID = System.IO.Path.GetFileNameWithoutExtension(controlToLoad);
    phViewControl.Controls.Add(mbl);
}
catch (Exception exc) //Module failed to load
{
    Exceptions.ProcessModuleLoadException(this, exc);
}

That is my preferred method of having complete control over what gets loaded in DNN (allowing for other modules to remain in the page)