C#关于findcontrol控件找的空值。。。

时间:2016-05-03 12:53:31   收藏:0   阅读:808

后台无法huoq到repeater中的控件

一开始我写的是:CheckBox cb = (CheckBox)this.FindControl("CheckBox1");

无奈找到的为null

后来查询得知

原来repeater是需要循环读取值的

 for (int i = 0; i < this.Repeater1.Items.Count; i++)
            {
                CheckBox cb = (CheckBox)this.Repeater1.Items[i].FindControl("CheckBox1");
               
            }

本文出自 “cholcce” 博客,请务必保留此出处http://cholcce.blog.51cto.com/8293148/1769602

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!