小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

ASP.NET添加動(dòng)態(tài)主題,不能動(dòng)態(tài)運(yùn)行

 昵稱o8H0y 2020-10-14

Default1.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default1.aspx.cs" 

    Inherits="Default1"%>

<!DOCTYPE html>

<html xmlns="http://www.">

<head runat="server">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <title></title>

</head>

<body>

    <form id="form1" runat="server">

        <div>

            <a href="https://www.csdn.net/">ASP.NET</a><br />

            <br />

            <a href="https://hao.360.com/">360瀏覽器</a>

            <br />

            <br />

            <input id="Button1" type="button" value="button"/>

            <br />

            <br />

            <asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">

                <asp:ListItem Value="Theme1">Theme1</asp:ListItem>

                <asp:ListItem Value="Theme2">Theme2</asp:ListItem>

            </asp:DropDownList>

            <br />

            <br />

            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

            <br />

            <br />

            <asp:TextBox ID="TextBox2" runat="server" SkinID="textboxSkin"></asp:TextBox>

        </div>

    </form>

</body>

</html>

Default1.aspx.cs:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

public partial class Default1 : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

    }

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)

    {

        string url = Request.Path + "?theme=" + DropDownList1.SelectedItem.Value;

        Response.Redirect(url);

    }

    void Page_PreInit(Object sender, EventArgs e)

    {

        string theme = "Theme1";

        if (Request.QueryString["theme"] == null)

        {

            theme = "Theme1";

        }

        else 

        {

            theme = Request.QueryString["theme"];

        }

        Page.Theme = theme;

        ListItem item = DropDownList1.Items.FindByValue(theme);

        if (item != null)

        {

            item.Selected = true;

        }

    }

}

  if (Request.QueryString["theme"] == null)

        {

            theme = "Theme1";  

           //問(wèn)題:設(shè)置theme="Theme1";顯示的就是主題Theme1,如果先設(shè)置了theme="Theme2",就顯示主題Theme2,不能和進(jìn)行動(dòng)態(tài)顯示。

        }

        else 

        {

            theme = Request.QueryString["theme"];

        }

以上深圳市博納網(wǎng)絡(luò)信息技術(shù)有限公司整理(www.sabong.net)

    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約