Tuesday, 9 September 2014

Remove Skin and Container from .ascx control in DotNetNuke

I was stuck in an annoying problem while working of one of my modules in DNN. The Ideas was to load a usercontrol while click on button, But instead of clean skinless form, DNN automatically add the container and skin into it. That bugged me a lot. So how can you open a .ascx user control in a popup/ new window in DotNetNuke without a Skin and Container. 


Here is the solution of the problem.

On the button onClick server side action use the following code

Globals.NavigateURL(
 TabId,
 "ControlName", "Param1", ParamValue,
 "SkinSrc=[G]" + Globals.QueryStringEncode( DotNetNuke.UI.Skins.SkinInfo.RootSkin + "/" + 
 Globals.glbHostSkinFolder + "/" + "No Skin" ),
 "ContainerSrc=[G]" + Globals.QueryStringEncode( DotNetNuke.UI.Skins.SkinInfo.RootContainer +
 "/" + Globals.glbHostSkinFolder + "/" + "No Container" )
);
or for simple not showing skin you can use

NavigateURL(
 TabId,
 "ControlName",  
 "Param1", 
 ParamValue,
 SkinSrc=[G]" + Globals.QueryStringEncode( DotNetNuke.UI.Skins.SkinInfo.RootSkin +
 "/" + Globals.glbHostSkinFolder + "/" + "No Skin" )
)


Explanation: [G] is used in Dotnetnuke as a placeholder for current portal location of the specific folder. No Skin is a skin file (No Skin.ascx) in Skin folder in path \portals. There is even a No Container.ascx in container folder if you dont want to use Container.


/Adnan


This post is from my old blog dated January 2012, that unfortunately no longer exist. 

About the Author

Adnan Zameer, Lead Developer at Optimizley UK, is a certified Microsoft professional, specializing in web app architecture. His expertise includes Optimizley CMS and Azure, showcasing proficiency in crafting robust and efficient solutions.

0 comments :

Post a Comment