asp.net 遍历repeater中的控件的几种方式
更新时间:2010年02月11日 15:01:30 作者:
遍历repeater中的控件的几种方式小结,需要的朋友可以参考下。
方式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;
}
}
相关文章
详解ASP.NET Core和ASP.NET Framework共享身份验证
本篇文章主要介绍了详解ASP.NET Core和ASP.NET Framework共享身份验证 ,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧2016-12-12asp.net DataFormatString格式化GridView
在GridView里面显示数据,要显示的数据有好多位小数,就想让它只显示两位小数,在delphi里,直接用DisplayFormat就行了,2009-08-08ASP.NET Core应用JWT进行用户认证及Token的刷新方案
本文详细讲解了ASP.NET Core应用JWT进行用户认证及Token的刷新方案,文中通过示例代码介绍的非常详细。对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧2021-12-12
最新评论