Repeater遍历

发布时间:2018-06-02编辑:佚名阅读(1392)

protected void Button1_Click(object sender, EventArgs e)  
{  
    List<int> idList = new List<int>();  
    foreach (RepeaterItem item in Repeater1.Items)  
    {  
        CheckBox cb = item.FindControl("CheckBox1") as CheckBox;  
        if (cb.Checked)  
        {  
            int id = int.Parse(cb.Attributes["dataID"]);  
            idList.Add(id);  
        }  
  
    }  
  
    foreach (var item in idList)  
    {  
        Response.Write(item + ",");  
    }  
}


  关键字:Repeater遍历


鼓掌

0

正能量

0

0

呵呵

0


评论区