This project is read-only.

Hide module

Aug 31, 2010 at 9:17 AM


I'm looking for a way to programmatically hide module container from within an XsltDb stylesheet: in normal modules I'd implement something like:


Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init

if testcondition=true then

 Me.ContainerControl.Visible = False

  end if

End Sub


But this needs access to PortalModuleBase, and I don't think it's possible to create an instance like:

Dim p as new PortalModuleBase(myModuleID)

p.ContainerControl.Visible = False


I could revert to client side scripting (e.g. jQuery.hide()), but would like to understand whether it would be possible to do this on the server. Any idea?


Aug 31, 2010 at 11:13 AM

You can access ASP.NET properties using mdo:aspnet() and mdo:assign().

This is a piece of code from one of my projects that does exactly what you need:

<xsl:if test="not($vips//vip) and not(mdo:aspnet('Module.IsEditable'))">
  <xsl:execute select="mdo:assign('Module.ContainerControl.Visible', false())" />
  • not($vips//vip) - This is bussiness condition when you need the module to be shown
  • not(mdo:aspnet('Module.IsEditable')) This condition allows modifying module for admins
  • mdo:assign('Module.ContainerControl.Visible', false()) - This code hides module.

Some description can be found here


Aug 31, 2010 at 11:25 AM


it's unbelievable how many things you can do with XsltDb :-D

Thanks once again!