解决方案 »

  1.   


    <%@ Control Language="C#" %><script runat="server">
      protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.Response.Cookies["theme, per user per site"].Value = this.DropDownList1.SelectedValue;
            this.Page.ClientScript.RegisterStartupScript(this.GetType(),"reload","setTimeout('window.location.href=window.location.href',1);", true);
        }
    </script><asp:DropDownList ID="DropDownList1" runat="server" 
        OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" AutoPostBack="True">
        <asp:ListItem>MSN_Blue</asp:ListItem>
        <asp:ListItem>MSN_CherryBlossom</asp:ListItem>
        <asp:ListItem>MSN_Finance</asp:ListItem>
        <asp:ListItem>MSN_Morning</asp:ListItem>
        <asp:ListItem>MSN_Purple</asp:ListItem>
        <asp:ListItem>MSN_Red</asp:ListItem>
        <asp:ListItem>WinXP_Blue</asp:ListItem>
        <asp:ListItem>WinXP_Silver</asp:ListItem>
    </asp:DropDownList>protected override void OnPreInit(EventArgs e)
        {
            base.OnPreInit(e);
            HttpCookie s = Request.Cookies["theme, per user per site"];
            if (s != null && s.Value != null)
                this.Theme = s.Value;
        }