遍历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;
??? }
?? }
轉(zhuǎn)載于:https://www.cnblogs.com/skyshenwei/archive/2010/03/03/1677031.html
總結(jié)
以上是生活随笔為你收集整理的遍历repeater中的控件的几种方式的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: JavaScript生成指定范围内的随机
- 下一篇: TForm1*Form1=newTFor