Hide Area in Workspace

Apr 8, 2011 at 3:37 PM

Hi. Is it possible hide to area in workspace? For example, I need to hide area if log in a role. Thank you

Apr 11, 2011 at 10:57 AM

Hi,

It is possible to hide an area in the workspace in the Init event of the page (or master if youre doing it globally).

in your master page create public properties to access the ribbon..

    ' Public properties to get access to the main ribbon from the pages...
    Public Property MasterRibbon As OfficeWebUI.OfficeRibbon
        Get
            Return Me.OfficeRibbon1
        End Get
        Set(ByVal value As OfficeWebUI.OfficeRibbon)
            Me.OfficeRibbon1 = value
        End Set
    End Property

    Public Property MasterWorkSpace As OfficeWebUI.OfficeWorkspace
        Get
            Return Me.Workspace1
        End Get
        Set(ByVal value As OfficeWebUI.OfficeWorkspace)
            Me.Workspace1 = value
        End Set
    End Property

    Public Property MasterManager As OfficeWebUI.Manager
        Get
            Return Me.Manager1
        End Get
        Set(ByVal value As OfficeWebUI.Manager)
            Me.Manager1 = value
        End Set
    End Property

Then on the Default page in this example in the page.init do the following..

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

        ' We want to hide the sales Area...
        ' first get a reference to the area in the master page... its a zero based index.. so...
        Dim theAreaToHide As OfficeWebUI.Workspace.Area = DirectCast(Master.MasterWorkSpace.Areas.Item(1), OfficeWebUI.Workspace.Area)
        Master.MasterWorkSpace.Areas.Remove(theAreaToHide)

    End Sub

Just remember to put a reference to the master page in your Default.aspx...

<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ MasterType VirtualPath="~/Site.master" %>

 That should get you on your way...