循环查找repeater中的控件

有时候需要在其它的方法中遍历数据控件中的项:

foreach (RepeaterItem item in this.rptList.Items)
            {
                if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)//Repeater控件中的类型==指定列表控件中的类型
                {
                    HtmlInputCheckBox cb = item.FindControl("cb") as HtmlInputCheckBox;
                    if (cb != null && cb.Checked)
                    {//获取选中的checkbox的值

                        guid = cb.Value;
                        break;
                    }
                }
            }

原文地址:https://www.cnblogs.com/Denny_Yang/p/2016112.html