惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cisco Talos Blog
Cisco Talos Blog
V
V2EX
C
Check Point Blog
GbyAI
GbyAI
D
Docker
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
Netflix TechBlog - Medium
T
Troy Hunt's Blog
博客园 - Franky
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Microsoft Security Blog
Microsoft Security Blog
P
Privacy & Cybersecurity Law Blog
WordPress大学
WordPress大学
The Cloudflare Blog
S
SegmentFault 最新的问题
Latest news
Latest news
Microsoft Azure Blog
Microsoft Azure Blog
P
Proofpoint News Feed
I
InfoQ
博客园 - 【当耐特】
NISL@THU
NISL@THU
A
About on SuperTechFans
T
Tailwind CSS Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
The Hacker News
The Hacker News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Scott Helme
Scott Helme
雷峰网
雷峰网
C
CXSECURITY Database RSS Feed - CXSecurity.com
Security Latest
Security Latest
V
Vulnerabilities – Threatpost
Security Archives - TechRepublic
Security Archives - TechRepublic
A
Arctic Wolf
Hacker News: Ask HN
Hacker News: Ask HN
N
News and Events Feed by Topic
IT之家
IT之家
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
aimingoo的专栏
aimingoo的专栏
T
Threat Research - Cisco Blogs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
SecWiki News
SecWiki News
大猫的无限游戏
大猫的无限游戏
S
Security Affairs
The Register - Security
The Register - Security
www.infosecurity-magazine.com
www.infosecurity-magazine.com
L
LINUX DO - 热门话题
T
Tor Project blog

博客园 - 东哥

MongoVUE 错误:can't map file memory - mongo requires 64 bit build for larger datasets HTTP Header 属性列表 安装卸载Windows服务,修改windows服务执行路径! SQL 语句嵌套,自己记录下。 基于RBAC的权限设计模型 javascript中getElementsByName的问题 三级连动JS数据库查询代码整理 数据库基本----SQL语句大全 使用Ajax时的十个常犯的错误 数据采集程序(网页小偷)点滴心得 WEB Service 下实现大数据量的传输 [转]将上传图片打上防伪图片水印并写入数据库 我奋斗了18年不是为了和你一起喝咖啡(转载) [转]社区好友列表利用率越高,社区越失败 很实用的一个图片上传得例子 [转帖]教程:使用WebService进行异步通信 如何用Javascript记录登陆次数 很酷实用的右键弹出菜单(Js+DVML) JavaScript如果文字过长,则将过长的部分变成省略号显示
动态添加WEB控件,点控件获取动态添加的控件
东哥 · 2008-06-18 · via 博客园 - 东哥

在PageLoad里代码如下
for (int i = 0; i < GridView1.Rows.Count; i++)
{
 TextBox txt = new TextBox();
 txt.ID = "txt" + i;
 GridView1.Rows[i].Cells[7].Controls.Add(txt);
}

在一个按钮的点击事件中
for (int i = 0; i < GridView1.Rows.Count; i++)
{
 Control controlText = GridView1.Rows[i].Cells[7].FindControl("txt" + i);
}

特别注意:

动态添加控件的代码不可放到非IsPostBack里,对动态添加的控件,无论是否IsPostBack都要执行才可以。
比如:

Page_Load()
{
 if (!this.IsPostBack)
 {

 }
 this.addControls();
}

posted on 2008-06-18 17:42  东哥  阅读(503)  评论(0)    收藏  举报