天天看點

面闆控件(Panel)

面闆控件(Panel).aspx

面闆控件(Panel)
面闆控件(Panel)

<% ... @ Page Language="C#" AutoEventWireup="true" CodeFile="面闆控件(Panel).aspx.cs" Inherits="面闆控件_Panel_"  %>

面闆控件(Panel)
面闆控件(Panel)

<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >

面闆控件(Panel)
面闆控件(Panel)

< html  xmlns ="http://www.w3.org/1999/xhtml"   >

面闆控件(Panel)

< head  runat ="server" >

面闆控件(Panel)

     < title > 面闆控件(Panel) </ title >

面闆控件(Panel)

</ head >

面闆控件(Panel)

< body >

面闆控件(Panel)

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

面闆控件(Panel)

     < div >

面闆控件(Panel)

         < asp:CheckBox  ID ="CheckBox1"  runat ="server"  AutoPostBack ="True"  Text ="是否顯示"  OnCheckedChanged ="CheckBox1_CheckedChanged"   />< br  />

面闆控件(Panel)

        Panel控件就是有個大的容器可以将其他的控件包含其中,在Panel中我在這裡設定了DefaultButton為button1也就上送出按鈕,當你按回車的時候,就相當于按了送出按鈕。 < br  />

面闆控件(Panel)

         < br  />

面闆控件(Panel)

         < asp:Panel  ID ="Panel1"  runat ="server"  Height ="50px"  Width ="125px"  DefaultButton ="Button1"  Visible ="False"   >

面闆控件(Panel)

             < asp:Label  ID ="Label1"  runat ="server"  Text ="姓名:" ></ asp:Label >

面闆控件(Panel)

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

面闆控件(Panel)

             < asp:Label  ID ="Label2"  runat ="server"  Text ="班級:" ></ asp:Label >

面闆控件(Panel)

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

面闆控件(Panel)

             < asp:Label  ID ="Label3"  runat ="server"  Text ="年齡:" ></ asp:Label >

面闆控件(Panel)

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

面闆控件(Panel)

             < asp:Button  ID ="Button1"  runat ="server"  Text ="送出"  OnClick ="Button1_Click"   />< asp:Button  ID ="Button2"

面闆控件(Panel)

                runat ="server"  Text ="取消"   /></ asp:Panel >

面闆控件(Panel)

         < br  />

面闆控件(Panel)

         < asp:Label  ID ="Label4"  runat ="server"  Text ="Label" ></ asp:Label >

面闆控件(Panel)

         < br  />

面闆控件(Panel)

         </ div >

面闆控件(Panel)

     </ form >

面闆控件(Panel)

</ body >

面闆控件(Panel)

</ html >

面闆控件(Panel)

 面闆控件(Panel).aspx.cs

面闆控件(Panel)

using  System;

面闆控件(Panel)

using  System.Data;

面闆控件(Panel)

using  System.Configuration;

面闆控件(Panel)

using  System.Collections;

面闆控件(Panel)

using  System.Web;

面闆控件(Panel)

using  System.Web.Security;

面闆控件(Panel)

using  System.Web.UI;

面闆控件(Panel)

using  System.Web.UI.WebControls;

面闆控件(Panel)

using  System.Web.UI.WebControls.WebParts;

面闆控件(Panel)

using  System.Web.UI.HtmlControls;

面闆控件(Panel)
面闆控件(Panel)

public   partial   class  面闆控件_Panel_ : System.Web.UI.Page

面闆控件(Panel)
面闆控件(Panel)

... {

面闆控件(Panel)

    protected void Page_Load(object sender, EventArgs e)

面闆控件(Panel)
面闆控件(Panel)

    ...{

面闆控件(Panel)
面闆控件(Panel)

    }

面闆控件(Panel)

    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)

面闆控件(Panel)
面闆控件(Panel)

    ...{

面闆控件(Panel)

        if (this.CheckBox1.Checked == true)

面闆控件(Panel)
面闆控件(Panel)

        ...{

面闆控件(Panel)

            this.Panel1.Visible = true;

面闆控件(Panel)

        }

面闆控件(Panel)

        else

面闆控件(Panel)
面闆控件(Panel)

        ...{

面闆控件(Panel)

            this.Panel1.Visible = false;

面闆控件(Panel)

        }

面闆控件(Panel)

    }

面闆控件(Panel)
面闆控件(Panel)

    protected void Button1_Click(object sender, EventArgs e)

面闆控件(Panel)
面闆控件(Panel)

    ...{

面闆控件(Panel)

        string str;

面闆控件(Panel)

        str ="您的姓名是:"+ this.TextBox1.Text+" ";

面闆控件(Panel)

        str += "您的班級是:"+this.TextBox2.Text+" ";

面闆控件(Panel)

        str += "您的性别是:"+this.TextBox3.Text+" ";

面闆控件(Panel)

        this.Label4.Text = str;

面闆控件(Panel)

    }

面闆控件(Panel)
面闆控件(Panel)
面闆控件(Panel)

}

面闆控件(Panel)

繼續閱讀