动态加载Textbox并取得输入值
来源:互联网 发布:seo外链软件 编辑:程序博客网 时间:2024/06/06 00:48
aspx:
<!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 id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Table ID="Table1" runat="server">
</asp:Table>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="aaa" />
</form>
</body>
</html>
cs:
protected void Page_Load(object sender, EventArgs e)
{
//if (!Page.IsPostBack) 千万不要加否则不能得到最新的值 我的亲身经验 我花了足足一
下午才发现的
//{
getTableRow();
//}
}
public void getTableRow()
{
//Table1.Rows.Clear();
int numrows = 3;
for (int j = 0; j < numrows; j++)
{
//if (i == 0)
//{
TableRow row = new TableRow();
TableCell cell = new TableCell();
TextBox text = new TextBox();
text.ID = "Name" + j.ToString();
//text.Text = ds.Tables[0].Rows[j]["test"].ToString();
//text.CssClass = "b";
//text.Attributes.Add("onclick", "javascript:test(this)");
//Label lbl = new Label();
//lbl.Text = "<IMG src=/"images/a.gif/" />";
//cell.Controls.Add(lbl);
cell.Controls.Add(text);
row.Cells.Add(cell);
// }
this.Table1.Rows.Add(row);
}
}
protected void Button1_Click(object sender, EventArgs e)
{
for (int j = 0; j < 3; j++)
{
string aa = "Name" + j.ToString();
TextBox box = (TextBox)this.FindControl(aa);
if (box != null)
{
Response.Write(box.Text + "ok了");
}
else
{
Response.Write("null");
}
}
}
- 动态加载Textbox并取得输入值
- 动态生成Checkbox并取得其值
- ASP.NET动态生成TextBox并获取其值
- ASP.NET动态生成TextBox并获取其值
- 加载数据库驱动并取得连接
- Flex4 动态取得控件 并更新数据源
- JS+PHP实现用户输入数字后取得最大的值并显示为第几个
- JS+PHP实现用户输入数字后取得最大的值并显示为第几个
- 如何在TextBox输入时动态读取DataBase内容
- asp.net 动态创建TextBox控件 如何加载状态信息
- Repeater取各项输入TextBox的值
- 在c#中动态添加控件,并保存输入值
- WinCE设备取得应用程序当前目录并加载配置文件
- 动态加载用户控件并带有传值
- ASP.NET中动态加载用户控件并传值
- jsp中取得服务器时间并动态显示
- easyui 动态计算两个textbox 的值
- 动态增删输入框和下拉列表框源代码------下拉列表值从数据库取得(Ajax)
- LVM术语与命令详解
- (网摘好文)关于野指针
- symbian s60 将一个带有目录的zip文件解压到指定目录
- 系分知识整理:电子政务简介
- Mysql中limit的用法方法详解与注意事项
- 动态加载Textbox并取得输入值
- ArcGIS 9.3 将ResourceManager中MapResourceItem0改成其他名称后出错
- VC剪贴板操作
- 简单测试MySQL 5.1 表分区功能
- j2me联网最佳实践
- 模拟退火(SA)
- blackberry 7290 滚轮 垂直滚动
- 外链
- 加强Eclipse代码自动提示的方法