New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the Community Exchange, where community members ask and answer questions about DNN. To get started, just start typing your question below and either select one of the suggested questions or ask a new question of your own.

loadskin /container programmatically from module code?

Return to previous page

  • 4/14/2014
  • 2733 Views

Question:

rudgr long time ago

Hi,

I would like to change the DNN skin/container dynamicly from my custom module based on some criteria (for example querystring)

I looked at the Skin.LoadSkin method, but this seems inaccessible since it is marked as private.

From dnn source I see that the sequence below is used to determine skin:

  • Querystring
  • cookie
  • Page Skin

Any other options to overrule the LoadSkin method from my custom module on a per request base?

tx

private static Skin LoadSkin(PageBase page, string skinPath) { Skin ctlSkin = null; try { string skinSrc = skinPath; if (skinPath.ToLower().IndexOf(Globals.ApplicationPath, StringComparison.Ordinal) != -1) { skinPath = skinPath.Remove(0, Globals.ApplicationPath.Length); } ctlSkin = ControlUtilities.LoadControl<Skin>(page, skinPath); ctlSkin.SkinSrc = skinSrc; //call databind so that any server logic in the skin is executed ctlSkin.DataBind(); } catch (Exception exc) { //could not load user control var lex = new PageLoadException("Unhandled error loading page.", exc); if (TabPermissionController.CanAdminPage()) { //only display the error to administrators var skinError = (Label)page.FindControl("SkinError"); skinError.Text = string.Format(Localization.GetString("SkinLoadError", Localization.GlobalResourceFile), skinPath, page.Server.HtmlEncode(exc.Message)); skinError.Visible = true; } Exceptions.LogException(lex); } return ctlSkin; }

loadskin /container programmatically from module code?

rudgr
rudgr long time ago
Add an Answer

Answers

Sign In to Participate
Or register to become a member