c#中如何通过web控件名得到该web控件对象

解决方案 »

  1.   

    vb.net的 
    CType(Me.FindControl("lblType1" ), Label).Text = NullToString(objDataset.Tables(0).Rows(i).Item("BANK_LOAN_NAME"))
      

  2.   

    如果空间所在的dll的名称为Test.dll1、如果该动态库已经引入项目,那么:Type t = Type.GetType("a.b.c,Test");//"A.B.C"为类的全称
    object obj = Activator.CreateInstance(type);//object就是控件的对象2、如果该动态库没有引入项目,那么:
    using System.Reflection;
    Assembly assembly = Assembly.Load("A") ;A为程序集名称
    Type t= assembly.GetType("A.B.C",true,true) ;A.B.C为类的全称
    //动态创建实例
    object obj = Activator.CreateInstance (t);//或者System.Reflection.Assembly ass = System.Reflection.Assembly.Load(nameSpace);
    object obj = ass.CreateInstance(className);
    Iobject op = (Iobject)obj;//Iobject为抽象类,是className的父类
      

  3.   

    1、如果该动态库已经引入项目,那么:Type t = Type.GetType("a.b.c,Test");//"A.B.C"为类的全称;Test是在参照表中显示的名称,比如System、System.Data等。
    object obj = Activator.CreateInstance(type);//object就是控件的对象
      

  4.   

    不好意思写错了,应该是:c#中如何通过web控件名得到该web控件属性
      

  5.   

    Type t_Tmp = XXXX.GetType();
      

  6.   

    不好意思写错了,应该是:c#中如何通过web控件名得到该web控件属性
    +++++++++++++++++++++
    如果你已经知道了该web控件的类型,那么:((类型)web控件名).属性