ASP.NET 动态创建TextBox 以及取值问题
来源:互联网 发布:教育软件排名 编辑:程序博客网 时间:2024/06/05 11:42
<asp:Panel ID="Panel1" runat="server">
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
<br />
<asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="Button2" />
<asp:TextBox ID="TextBox1" runat="server">
protected void Page_Load(object sender, EventArgs e) {
}
protected void Page_Init(object sender, EventArgs e) {
TextBox t1 = new TextBox(); t1.ID = "TextBox2";
TextBox t2 = new TextBox(); t2.ID = "TextBox3";
t1.EnableViewState = true;
t2.EnableViewState = true;
t1.ViewStateMode = ViewStateMode.Enabled;
t2.ViewStateMode = ViewStateMode.Enabled;
Panel1.Controls.Add(t1); Panel1.Controls.Add(t2);
t1.Visible = false;
t2.Visible = false; }
protected void Button1_Click(object sender, EventArgs e) {
TextBox t1 = (TextBox)Panel1.FindControl("TextBox2");
TextBox t2 = (TextBox)Panel1.FindControl("TextBox3");
t1.Visible = true;
t2.Visible = true;
}
protected void Button2_Click(object sender, EventArgs e) {
TextBox t1 = (TextBox)Panel1.FindControl("TextBox2");
TextBox t2 = (TextBox)Panel1.FindControl("TextBox3");
String a =t1.Text.ToString();
String b =t2.Text.ToString();
}
点击button1后页面出现事先定义好的textbox
点击button2把textbox内填入的值取回
- ASP.NET 动态创建TextBox 以及取值问题
- .net 2.0 只读TextBox取值问题
- asp.net 动态创建TextBox控件 如何加载状态信息
- asp.net 中TextBox只读时在客户端赋值后的取值问题
- asp.net中TextBox设为只读后的取值问题
- asp.net中TextBox设为只读后的取值问题
- ASP.Net TextBox只读时不能取值
- ASP.Net TextBox只读时不能取值的解决方案
- ASP.Net TextBox只读时不能取值的解决方案
- asp.net TextBox边框问题
- ASP.NET动态生成TextBox并获取其值
- ASP.NET动态生成TextBox并获取其值
- ASP.NET 2.0 动态创建控件问题
- ASP.NET 2.0 中动态添加 GridView 模板列 以及取值的例子
- ASP.NET 2.0 中动态添加 GridView 模板列 以及取值的例子
- ASP.NET 2.0 中动态添加 GridView 模板列 以及取值的例子
- ASP.NET动态添加TextBox控件
- ASP.NET动态添加TextBox控件
- 当前多数杀软主防存在的缺陷
- MFC中编辑框的显示与隐藏
- Notification案例- 多个任务单线程下载共用一个notification显示进度
- mysql数据库中的索引有那些、有什么用?
- LSI设计(1)一般介绍(待上载)
- ASP.NET 动态创建TextBox 以及取值问题
- ExecutorService常用方法和newFixedThreadPool创建固定大小的线程池
- windows下如何安装java6.0
- 游戏引擎列表
- assert()函数用法总结
- Android中Service与Thread的区别
- Ubuntu10.04制作官方源镜像以及搭建本地
- LSI设计(2)布局算法(待上载)
- 3天学习haskell---haskell第二天