之前看过一篇博文。

http://www.cnblogs.com/hermes262/archive/2006/03/03/342261.html

3种方式遍历repeater中的CheckBox全选

 

自己用却又很多错误。求解。

            for (int i = 0; i < this.Play_ListRepeater.Items.Count; i++)
            {
                HtmlInputCheckBox check =(HtmlInputCheckBox)this.Play_ListRepeater.Items[i].FindControl("Music_Check_Box");   //遍历
                HtmlInputCheckBox asd = new HtmlInputCheckBox();
                //Label Music_lable = (Label)this.Play_ListRepeater.Items[i].FindControl("Music_Name");
                //if (check.Checked == true)
                //{
                //    string aa = check.Value;
                //    string bb = check.Name;
                //}
                if (asd != null)
                {
                    string aa = asd.Value;
                    string bb = asd.Name;
                }
                else
                {
                    string aa = asd.Value;
                    string bb = asd.Name;
                }

                if (check != null)
                {
                    string aa = check.Value;
                    string bb = check.Name;
                }
                else
                {
                    string aa = check.Value;
                    string bb = check.Name;
                }