错了,是这个,看看这个有什么毛病,请指正 
foreach (Control c1 in Page.Controls)
        {
            if (c1 != null&&c1 is DropDownList)
            {
                DropDownList c2 = (DropDownList)c1;            if (c1.SelectedValue != "请选择")
            {
                //Label25.Text = c2.UniqueID.ToString();
                Response.Write("sdfsdf" + c1.ID);            }        }

解决方案 »

  1.   

    foreach (Control c1 in Page.Controls)
            {
                if (c1 != null&&c1 is DropDownList)
                {
                    DropDownList c2 = (DropDownList)c1;            if (c2.SelectedValue != "请选择")
                {
                    //Label25.Text = c2.UniqueID.ToString();
                    Response.Write("sdfsdf" + c2.ID);            }        }
      

  2.   

    for   (int   i=0;   i<   this.Controls.Count;   i++)   
      {   
      if   (this.Controls[i]   is   DropDownList)     
      {//你的代码}   
      }
      

  3.   

    不行阿,我要得到dropdownlist的选定值啊,但点击buton后,没出现想要的
      

  4.   

    顺便说一下,我的dropdownlist全封装在panel中
      

  5.   

    试了下,行的呀
            
            foreach (Control control in pnlDropdownListGroup.Controls)
            {
                if (null != control && control is DropDownList)
                {
                    DropDownList ddl = control as DropDownList;
                    if (ddl.SelectedValue != "请选择")
                    {
                        Response.Write("My ID is: " + ddl.ID);
                    } 
                }
            }