Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

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 DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...module on a page but hiddenmodule on a page but hidden
Previous
 
Next
New Post
3/8/2014 11:19 AM
 
how is an easy way to put a module on a page that is hidden. this module has to run code in it's user control but I don't want it seen on the page.
 
New Post
3/8/2014 1:02 PM
 
there are plenty of ways to hide modules (see http://www.dnnsoftware.com/community-...), however when they're hidden they don't execute - if you want something that runs on a page but doesn't show markup either create a module that doesn't have any markup and put it in a "blank" container, or else it it's intended for more pages create a httpmodule.

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
3/8/2014 8:57 PM
 

If you are writing your OWN module you can do something like the following - basically first we make sure there is a way to find the module if you are logged in as admin - and the page is in editmode.
In that specific case - allow the containcontrol to be visible.
Otherwise set the containercontrol to hidden.
Any code you want to run can be put in this module - it will still fire - regardless of if it gets displayed on the page.

protected void Page_Load(object sender, EventArgs e)
{
// set some variables - just to make it obvious what we are doing - could all be inline.
// basically do some test to see if the module should be visible for any reason
// usually some test for the current using being having admin rights to the page 
// and maybe if the page is in editmode

Bool isADMIN = ((PortalSettings.UserInfo != null &&PortalSettings.UserInfo.IsSuperUser) || TabPermissionController.CanAdminPage()) 

Bool isEDITMODE =  this.IsEditable;

if (isADMIN && isEDITMODE) 
{
//  this is the normal action for a page - let this happen in editmode for admins so that the module can be found
// on the page and removed or its settings edited
 ContainerControl.Visible = true;  // does not really need to be set here - just put in for explanation
}
else
{
// hide the module container and the module itself - nothing will be shown on the page
 ContainerControl.Visible = false;
}

//// do you hidden processing code here

}


 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...module on a page but hiddenmodule on a page but hidden


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out