Response.Write(LabelId.ToString())
Response.Write("<br>")
Response.Write(LabelId.GetType())

解决方案 »

  1.   

    不好意思 
    这个我不是很明白
    我这样写的
    IF objControl = TextBox then
        a()
    else 
        b()
    end if
    但是报错,原因在那里?
      

  2.   

    try
    objControl = TextBox  ----> objControl is TextBox
      

  3.   

    if(ctl is TextBox)
    ...
    else if(ctl is LinkButton)
    ....
      

  4.   

    if(ctl.ToString()=="System.Web.UI.Controls.TextBox")
    ....
    else if(ctl.ToString()=="System.Web.UI.Controls.Label")
    ....
      

  5.   

    或者可以用一下这个if(Object.Equals(ctl,System.Web.UI.Controls.TextBox))
    ......
    ....
      

  6.   

    我认为xiahouwen(活靶子.NET)说得是正确的,报什么错?
    贴出来啊.
      

  7.   

    xiahouwen(活靶子.NET)说得没错,用 is 最合适。