Use WorkSpace content controls in Ribbon events when it's on masterpage

Mar 29, 2011 at 2:37 PM


I have a ribbon on my masterpage, and a workspace which has the different aspx pages as content.

I would like to be use my content controls (gridview, drowdowns, labels, textboxes, ...) when clicking on the Ribbon buttons.

How do I do this ? The click events of the ribbon are called inside the masterpage, not in the content page itself...

Mar 29, 2011 at 2:57 PM


dont know what language youre using but i would do this in the load and init events of the aspx page... like so..

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

	If Not Page.IsPostBack Then

		Master.MainWorkSpace.SelectedAreaID = "Area_Administration"
         		Master.MainWorkSpace.SelectedItemID = "Item_GridView1"


            End If

        End Sub

 In the Init construct the context menu referred to above..

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

            Dim lNewContext As OfficeWebUI.Ribbon.RibbonContext = New OfficeWebUI.Ribbon.RibbonContext

            lNewContext.ID = "ContextMyGridPage"
            lNewContext.Text = "Modules"
            lNewContext.ContextColor = "orange"

            Dim INewTab1 As OfficeWebUI.Ribbon.RibbonTab = New OfficeWebUI.Ribbon.RibbonTab
            INewTab1.ID = "TabMyGridTab"
            INewTab1.Text = "My GridView Options"

            Dim INewGroup1 As OfficeWebUI.Ribbon.RibbonGroup = New OfficeWebUI.Ribbon.RibbonGroup
            INewGroup1.ID = "Group_Editing"
            INewGroup1.Text = "Editing"
            INewGroup1.ShowExpander = False

            Dim lNewGroup1Zone1 As OfficeWebUI.Ribbon.GroupZone = New OfficeWebUI.Ribbon.GroupZone

            Dim ItemCreate As OfficeWebUI.Ribbon.LargeItem = New OfficeWebUI.Ribbon.LargeItem
            ItemCreate.ID = "Item_Create"
            ItemCreate.Text = "<b>Create</b>"
            ItemCreate.ImageUrl = "~/Common/Images/32/icon93_32.png"
            AddHandler ItemCreate.Click, AddressOf ItemCreate_Click

End Sub
You will notice on the last line in the init that you can add a handler and from there you can do what you want...
Hope it helps..