子晴的编程日记

记录我的编程日记

导航

Repeater循环页面上的控件

 List<string> list = new List<string>();

for (int k = 0; k < RepeaterList.Items.Count; k++)
{
//根据控件id获得控件对象,ckSelect是checkBox控件的id
CheckBox chksel = (CheckBox)RepeaterList.Items[k].FindControl("ckSelect");

if (chksel != null)
{
if (chksel.Checked)
{
//获取id记录,cb.ToolTip里存放的就是记录id
string controlName = chksel.ID; //控件名称
string id = chksel.ToolTip; //绑定数据ID值
list.Add(id);

}

}

}

posted on 2019-05-29 17:26  子晴的编程日记  阅读(180)  评论(0编辑  收藏  举报