3种方式遍历repeater中的控件,可作为CheckBox全选
2005-09-11 00:08
435 查看
方式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;
}
}
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;
}
}
相关文章推荐
- 3种方式遍历Repeater中的CheckBox全选
- 3种方式遍历repeater中的CheckBox全选
- 3种方式遍历Repeater中的CheckBox并全选
- 3种方式遍历Repeater中的CheckBox全选
- 3种方式遍历Repeater中的CheckBox并全选
- 3种方式遍历Repeater中的CheckBox全选
- 3种方式遍历repeater中的CheckBox全选
- 3种方式遍历Repeater中的CheckBox全选
- 3种方式遍历Repeater中的CheckBox全选
- 3种方式遍历repeater中的CheckBox全选
- 3种方式遍历repeater中的CheckBox全选
- 3种方式遍历Repeater中的CheckBox并全选
- 3种方式遍历repeater中的CheckBox全选
- 3种方式遍历Repeater中的CheckBox全选
- 3种方式遍历Repeater中的CheckBox全选
- 3种方式遍历Repeater中的CheckBox全选
- 3种方式遍历Repeater中的CheckBox全选
- 种方式遍历repeater中的CheckBox全选
- 种方式遍历repeater中的CheckBox全选
- js在repeater控件内每一行<input type="checkbox"/>实现全选,全不选,然后获取每一行的ID删除