panel用法
来源:互联网 发布:雷人电视剧知乎 编辑:程序博客网 时间:2024/06/03 01:51
源文件
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:Panel ID="Panel1" runat="server" BackColor="#6666FF" BorderColor="#CC0000"
BorderStyle="Dashed" Height="113px">
</asp:Panel>
<p>
<span lang="zh-cn">添加<asp:DropDownList ID="DropDownList1" runat="server"
AutoPostBack="True">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
</asp:DropDownList>
个LABEL控件</span></p>
<p>
<span lang="zh-cn">添加<asp:DropDownList ID="DropDownList2" runat="server"
AutoPostBack="True">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
</asp:DropDownList>
个TEXTBOX控件</span></p>
<p>
<span lang="zh-cn">添加<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
字符进去</span></p>
<p>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="添加" />
<asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="True"
oncheckedchanged="CheckBox2_CheckedChanged" />
</p>
</form>
</body>
</html>
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 _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
int a = int.Parse(DropDownList1.SelectedItem.Value);
for (int i = 1; i <= a; i++)
{
Label lb = new Label();
lb.ID = "lb" + i;
lb.Text = "玉哥" + i.ToString();
Panel1.Controls.Add(lb);
}
int b = int.Parse(DropDownList2.SelectedItem.Value);
for (int i = 1; i <= b; i++)
{
TextBox tb = new TextBox();
tb.ID = "tb" + i;
tb.Text = "tb" + i.ToString();
Literal lt = new Literal();
lt.Text = "<br>";
Panel1.Controls.Add(tb);
Panel1.Controls.Add(lt);
}
Literal txt = new Literal();
txt.Text = TextBox1.Text;
Panel1.Controls.Add(txt);
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
//if (!CheckBox1.Checked)
//{ CheckBox1.Text = "隐藏";
// Panel1.Visible = true;
//}
//else
//{ CheckBox1.Text = "显示";
// Panel1.Visible = false;
//}
}
protected void CheckBox2_CheckedChanged(object sender, EventArgs e)
{
if (!CheckBox2.Checked)
{
Panel1.Visible = true;
CheckBox2.Text = "请选择隐藏";
}
else
{
Panel1.Visible = false;
CheckBox2.Text = "请选择显示";
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:Panel ID="Panel1" runat="server" BackColor="#6666FF" BorderColor="#CC0000"
BorderStyle="Dashed" Height="113px">
</asp:Panel>
<p>
<span lang="zh-cn">添加<asp:DropDownList ID="DropDownList1" runat="server"
AutoPostBack="True">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
</asp:DropDownList>
个LABEL控件</span></p>
<p>
<span lang="zh-cn">添加<asp:DropDownList ID="DropDownList2" runat="server"
AutoPostBack="True">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
</asp:DropDownList>
个TEXTBOX控件</span></p>
<p>
<span lang="zh-cn">添加<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
字符进去</span></p>
<p>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="添加" />
<asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="True"
oncheckedchanged="CheckBox2_CheckedChanged" />
</p>
</form>
</body>
</html>
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 _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
int a = int.Parse(DropDownList1.SelectedItem.Value);
for (int i = 1; i <= a; i++)
{
Label lb = new Label();
lb.ID = "lb" + i;
lb.Text = "玉哥" + i.ToString();
Panel1.Controls.Add(lb);
}
int b = int.Parse(DropDownList2.SelectedItem.Value);
for (int i = 1; i <= b; i++)
{
TextBox tb = new TextBox();
tb.ID = "tb" + i;
tb.Text = "tb" + i.ToString();
Literal lt = new Literal();
lt.Text = "<br>";
Panel1.Controls.Add(tb);
Panel1.Controls.Add(lt);
}
Literal txt = new Literal();
txt.Text = TextBox1.Text;
Panel1.Controls.Add(txt);
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
//if (!CheckBox1.Checked)
//{ CheckBox1.Text = "隐藏";
// Panel1.Visible = true;
//}
//else
//{ CheckBox1.Text = "显示";
// Panel1.Visible = false;
//}
}
protected void CheckBox2_CheckedChanged(object sender, EventArgs e)
{
if (!CheckBox2.Checked)
{
Panel1.Visible = true;
CheckBox2.Text = "请选择隐藏";
}
else
{
Panel1.Visible = false;
CheckBox2.Text = "请选择显示";
}
}
}
- panel用法
- Panel的基本用法
- Panel的用法
- Extjs.grid.Panel用法
- panel的常见用法小计
- 【AngularJS】panel基本用法——最基本的panel
- panel
- panel
- ASP.net中Panel控件用法
- ASP.net中Panel控件用法
- 【Extjs】Model,Store,grid.panel 用法
- ExtJs之结构树 Ext.tree.panel详细用法
- panel添加panel
- panel,button的用法--flex--宽/高-application也可以设置w/h
- ExtJS学习之路第六步:深入讨论组件Panel用法
- qq panel
- 容器Panel
- Ext.Panel
- SWT,打包发布SWT程序,转EXE一条龙过程记录 一Eclipse下安装SWT
- listbox移位
- Multiview和View
- Delphi 6 XML数据绑定
- 网络游戏给现实生活带来的影响
- panel用法
- 网页中如何改变IE标题栏中的图标
- SQL事物存储过程实现联级删除
- SQL用户登陆验证
- IIS出错造成inetinfo.exe进程占用CPU100%
- treeview绑数据库
- Google发现的十大真理
- 选择什么样的DOCTYPE(转载)
- Winform按钮跳转网页