asp.net 遍历repeater中的控件的几种方式_asp.net教程-查字典教程网
asp.net 遍历repeater中的控件的几种方式
asp.net 遍历repeater中的控件的几种方式
发布时间:2016-12-29 来源:查字典编辑
摘要:方式1:复制代码代码如下:foreach(Controlcinthis.Repeater1.Controls){HtmlInputCheck...

方式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;

}

}

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新asp.net教程学习
    热门asp.net教程学习
    编程开发子分类