<%@ Master Language="C#" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["MySkin"] != null)
        {
            RadSkinManager1.Skin = (string)Session["MySkin"];
        }

        RadComboBox chooser = (RadComboBox)RadSkinManager1.Controls[0];
        chooser.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(chooser_SelectedIndexChanged);
    }
    
    protected void Page_PreRender(object sender, EventArgs e)
    {
        RadComboBox chooser = (RadComboBox)RadSkinManager1.Controls[0];

        if (Session["ShowChooser"] != null)
        {
            chooser.Visible = CheckBox1.Checked = (bool)Session["ShowChooser"];
        }
    }
    
    void chooser_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        Response.Write(String.Format("Skin changed to {0}", RadSkinManager1.Skin));
        Session["MySkin"] = RadSkinManager1.Skin;
    }

    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
    {
        Session["ShowChooser"] = CheckBox1.Checked;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
    <asp:CheckBox ID="CheckBox1" AutoPostBack="true" Checked="true" 
        Text="Show chooser" runat="server" 
        oncheckedchanged="CheckBox1_CheckedChanged" />
    <telerik:RadSkinManager ID="RadSkinManager1" Skin="Forest" ShowChooser="true" runat="server">
    </telerik:RadSkinManager>
    <br /><br /><br />
    <div>
        <b>Control declared in master page</b>
        <telerik:RadComboBox ID="RadComboBox1" runat="server">
            <Items>
                <telerik:RadComboBoxItem Text="1" />
                <telerik:RadComboBoxItem Text="2" />
            </Items>
        </telerik:RadComboBox>
        <br /><br />
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>
