打印本文 打印本文 关闭窗口 关闭窗口
*Using the ASP.NET Panel Control...
作者:武汉SEO闵涛  文章来源:敏韬网  点击数1877  更新时间:2009/4/23 10:45:00  文章录入:mintao  责任编辑:mintao
System.Web.UI.WebControls.Label
  Protected WithEvents txtState As System.Web.UI.WebControls.TextBox
  Protected WithEvents lblZipCode As System.Web.UI.WebControls.Label
  Protected WithEvents txtZipCode As System.Web.UI.WebControls.TextBox
  Protected WithEvents lblPhone As System.Web.UI.WebControls.Label
  Protected WithEvents txtPhone As System.Web.UI.WebControls.TextBox
  Protected WithEvents lblCellPhone As System.Web.UI.WebControls.Label
  Protected WithEvents txtCellPhone As System.Web.UI.WebControls.TextBox
  Protected WithEvents lblFax As System.Web.UI.WebControls.Label
  Protected WithEvents txtFax As System.Web.UI.WebControls.TextBox
  Protected WithEvents pnlPhone As System.Web.UI.WebControls.Panel

  Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    pnlName.Visible = True
    pnlPhone.Visible = False
    pnlAddress.Visible = False
  End Sub

  Public Sub Button_Click (sender As System.Object, e As system.Web.UI.WebControls.CommandEventArgs)
    If e.CommandName="address" Then
      pnlName.Visible = False
      pnlPhone.Visible = False
      pnlAddress.Visible = True
    ElseIf e.CommandName = "name" Then
      pnlPhone.Visible = False
      pnlAddress.Visible = False
      pnlName.Visible = True
    ElseIF e.CommandName = "phone" Then
      pnlAddress.Visible = False
      pnlName.Visible = False
      pnlPhone.Visible = True
    End If
  End Sub
End Class

In conclusion I hope you can see how easy it is to utilize panel controls and how they can bring some order and organization to your very large web forms.

You may run the example program here.
You may download the code here.

上一页  [1] [2] 

打印本文 打印本文 关闭窗口 关闭窗口