Panel容器控件

nel容器控件在web窗体页内提供了一种容器,在它内部可以放入其他的控件,对于以编程方式生成控件以及显示和隐藏控件很有用。Panel控件的一般形式为(将牛腩新闻发布系统的一部分用了Panel控件):

<asp:Panel id="控件名称"
   BackImageURL="url"  runat="server">
</asp:Panel>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Web.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>牛腩新闻发布系统</title>
    <link href="CSS/Common.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
        <div>
        <asp:Panel ID="Panel1" runat="server" BackColor="SkyBlue" Height="208px" Width="448px">
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;最新新闻<br />
            热点新闻:&nbsp; &nbsp;<asp:TextBox ID="TextBox1" runat="server" BackColor="#c0c0ff" ForeColor="Black" OnTextChanged="TextBox1_TextChanged"></asp:TextBox><br />
            <br />
            时事新闻:&nbsp; &nbsp;<asp:TextBox ID="TextBox2" runat="server" BackColor="#c0c0ff" ForeColor="Black"></asp:TextBox><br />
            <br />
            新浪新闻:&nbsp; &nbsp;<asp:TextBox ID="TextBox3" runat="server" BackColor="#c0c0ff" ForeColor="Black"></asp:TextBox><br />
            <br />
            网易新闻:&nbsp; &nbsp;<asp:TextBox ID="TextBox4" runat="server" BackColor="#c0c0ff" ForeColor="Black"></asp:TextBox><br />
        </asp:Panel>
        &nbsp;</div>   
        <br />
        <asp:Panel ID="Panel2" runat="server" BackColor="PowderBlue" Height="208px" Width="448px" Visible="false">
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
         新闻评论<br /><br /><br />
         新闻评论:<asp:TextBox ID="TextBox5" ReadOnly="true"  runat="server" Height="100px"  TextMode="MultiLine" ></asp:TextBox></asp:Panel>       
        <br />
        /*显示新闻评论按钮*/
        <asp:Button ID="ViewPanel2" runat="server" Height="24px" OnClick="ViewPanel2_Click" Text="显示新闻评论"  Width="192px" />&nbsp;
    </form>
  </body>
</html>
  protected void ViewPanel2_Click(object sender, EventArgs e)
        {
             //设置Panel2为True
            Panel2.Visible = true;
        }

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 14
    评论
评论 14
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值