错了,是这个,看看这个有什么毛病,请指正
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); } }
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); } }
{
if (c1 != null&&c1 is DropDownList)
{
DropDownList c2 = (DropDownList)c1; if (c2.SelectedValue != "请选择")
{
//Label25.Text = c2.UniqueID.ToString();
Response.Write("sdfsdf" + c2.ID); } }
{
if (this.Controls[i] is DropDownList)
{//你的代码}
}
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);
}
}
}