会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
程序员的经商之道
我们不再做挖金矿的工人,我们用自己的智慧挖取金矿冶炼金! Using no way as way, having no limitation as limitation
博客园
首页
新随笔
联系
订阅
管理
3种方式遍历repeater中的CheckBox全选
方式1:
foreach
(Control c
in
this
.Repeater1.Controls)
{
HtmlInputCheckBox check
=
(HtmlInputCheckBox)c.FindControl(
"
cbDelete1
"
);
if
( check
!=
null
)
{
check.Checked
=
true
;
}
}
方式2:
for
(
int
i
=
0
;i
<
this
.Repeater1.Items.Count;i
++
)
{
HtmlInputCheckBox check
=
(HtmlInputCheckBox)
this
.Repeater1.Items[i].FindControl(
"
cbDelete1
"
);
if
( check
!=
null
)
{
check.Checked
=
true
;
}
}
方式3:
foreach
( RepeaterItem item
in
this
.Repeater1.Items )
{
HtmlInputCheckBox check
=
(HtmlInputCheckBox)item.FindControl(
"
cbDelete1
"
);
if
( check
!=
null
)
{
check.Checked
=
true
;
}
}
posted @
2006-08-25 22:44
lanjue
阅读(
336
) 评论(
0
)
收藏
举报
刷新页面
返回顶部
公告