给他们一个一个的label.clear()

解决方案 »

  1.   

    //不知道能不能行
    foreach(Control c in this.Controls)
    {
    if(c.gettype() ==  System.Windows.Forms.TextBox.gettype())
    {
    ((TextBox)c).Text ="";
    }
    }
      

  2.   

    //不知道能不能行
    foreach(Control c in this.Controls)
    {
    if(c.gettype() ==  System.Web.UI.WebControls.Label.gettype())
    {
    ((Label)c).Text ="";
    }
    }
      

  3.   

    未经测试,就这个意思:
    foreach (System.Web.UI.Control Ctl in this.Controls)
    {
    if(Ctl.GetType()==System.Type.GetType("System.Web.UI.WebControls.Label"))
    {
                 Ctl.Text="";
             }
    }
      

  4.   

    未经测试,就这个意思:
    foreach (System.Web.UI.WebControls.Label Lbl in this.Controls)
    {

                 Lbl.Text="";
            
    }
      

  5.   

    foreach( Control objSourceCtrl in this.Controls )
    {
     if ( objSourceCtrl.GetType().ToString() == "System.Windows.Forms.Label" )
     {
          label1.Clear();
     }
    }测试OK.
      

  6.   

    label1.Clear();
    __>(Label)objSourceCtrl.Clear();改一句话