1/16/2009

Using the PortalSettings class in containers

It’s simple, but useful: If you try to use the PortalSettings class in code you have added to a container’s  .ascx file, you’ll find out that you can’t. The PortalSettings shared class is only directly accessible from skins.

 

That’s dissapointing, especially when you need to grab things like, for example, the current tab id (PortalSettings.ActiveTab.TabId) inside a container for some reeson.

 

The solution to this is to grab your PortalSettings contents from the HttpContext and use it like this:

 

<script runat="server"> 

Dim _portalSettings As PortalSettings 
_portalSettings = CType( _
   
HttpContext.Current.Items("PortalSettings") _
   
, PortalSettings)

</script>

 

In order to get, for example, the current tab id from your container, you can now use _portalSettings.ActiveTab.Tabid.

Read more...
Related Posts with Thumbnails

Recent Comments

Free DotNetNuke Stuff

Free DotNet Videos

  © Blogger template The Professional Template by Ourblogtemplates.com 2008

Back to TOP