更改主题的按钮,怎么样? [英] changing themes with buttons, how?

查看:94
本文介绍了更改主题的按钮,怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个主题,我想在网站上使用,以及它们在主题结算文件夹 - > THEME1和THEME2,在THEME1和THEME2我有一个.css文件。
因此,如何将这些我.css文件连接到两个按钮,当我在Button1的Click我想theme1.css激活和THEME2。
如果您需要了解更多的问题问的信息。
谢谢

I have 2 themes that i want to use on site, and they are settled in Themes Folder-> theme1 and theme2 , in theme1 and theme2 i have one .css file. So how will I connect these .css files to two buttons and when i click on button1 i want to theme1.css activates and for theme2. If you need more informations about problem ask. thanks

推荐答案

我已经创建了asp.net一个示例应用程序检查了这一点,让我知道如果有一些疑问。

I have created a sample application in asp.net check out this,and let me know if there is some doubt.

更新

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ProfilePage.aspx.cs" Inherits="ProfilePage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="test" Text="Stackoverflow" runat="server"></asp:Label>
        <asp:Button ID="Button1" runat="server" Text="Theme1" OnClick="Button1_Click" />
        <asp:Button ID="Button2" runat="server" Text="Theme2" OnClick="Button2_Click" />
    </div>
    </form>
</body>
</html>




using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ProfilePage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Page_PreInit(object sender, EventArgs e)
    {
        switch (Request.QueryString["theme"])
        {
            case "Blue":
                Page.Theme = "Blue";
                break;
            case "Red":
                Page.Theme = "Red";
                break;
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("ProfilePage.aspx?theme=Red");
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect("ProfilePage.aspx?theme=Blue");
    }
}

这篇关于更改主题的按钮,怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆