Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls

Partial Public Class Menu_UpdatePanel
    Inherits System.Web.UI.Page
    'Global variables
    Protected Shared Skin As String = ""
    Protected Shared [Structure] As String = ""


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim sm As ScriptManager = ScriptManager.GetCurrent(Page)

        'Set defaults
        If sm.IsInAsyncPostBack = False AndAlso Page.IsCallback = False AndAlso Page.IsPostBack = False Then
            Skin = "Classic"
            [Structure] = "Default.xml"
        End If

        'Check defaults
        If Skin = "" Then
            Skin = "Classic"
        End If
        If [Structure] = "" Then
            [Structure] = "Default.xml"
        End If

        BuildControl()
    End Sub


    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
        Skin = "Office2003"
        [Structure] = "Office2003.xml"
        BuildControl()
    End Sub


    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs)
        Skin = "Win7"
        [Structure] = "Win7.xml"
        BuildControl()
    End Sub


    Private Sub BuildControl()
        myMenu.StructureFileURL = "~/Menu/Structures/" & _
            [Structure]
        myMenu.SkinFolder = "~/Menu/Skins/" & _
            Skin
        myMenu.DataBind()
    End Sub

End Class