?? panel.aspx
字號:
<% @ Import Namespace="System.Drawing" %>
<Script Language="C#" Runat="Server">
public void Page_Load(Object src,EventArgs e)
{
if(Page.IsPostBack)
{
//如果不是第一次調用本頁,則首先隱藏所有Panel
Panel1.Visible = false;
Panel2.Visible = false;
Panel3.Visible = false;
}
}
public void Selected(Object sender,EventArgs e)
{
Panel p = (Panel)FindControl(DropDown.SelectedItem.Text);
//將選中的Panel顯示
p.Visible = true;
p.ForeColor=Color.Red;
}
</script>
<html>
<head>
<title></title>
</head>
<body>
<form runat="server">
<b>Panel控件演示</b>
<hr>
<asp:Panel id="Panel1" runat="server"
Wrap="True"
>
<asp:Label id="lb1" Text="這是第一個Panel控件" Font-Bold="True" runat="server" />
</asp:Panel>
<hr>
<asp:Panel id="Panel2" runat="server"
Wrap="True"
>
<asp:Label Text="這是第二個Panel控件" Font-Bold="True" runat="server" />
</asp:Panel>
<hr>
<asp:Panel id="Panel3" runat="server"
Wrap="True"
>
<asp:Label Text="這是第三個Panel控件" Font-Bold="True" runat="server" />
</asp:Panel>
<hr>
請選擇需要顯示的Panel:<br>
<asp:DropDownList id="DropDown" AutoPostBack="True" OnSelectedIndexChanged="Selected" runat="server">
<asp:ListItem>Panel1</asp:ListItem>
<asp:ListItem>Panel2</asp:ListItem>
<asp:ListItem>Panel3</asp:ListItem>
</asp:DropDownList>
</form>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -