zoukankan      html  css  js  c++  java
  • 如何在后台代码中设置和获取用户控件中的子控件的属性? dodo

    >>>1、如何在后台代码中设置和获取用户控件中的子控件的属性?  
       
      add   public   properties/methods   in   your   codebehind   class   for   your   usercontrol   and   declare   in   your   page   class:  
       
      protected   YourUserControlCodeBehindClass   YourUserControlID;  
       
      ..  
       
      if   you   don't   have   a     codebehind   class,   you   can   always   do  
       
      UserControl   c   =   (UserControl)FindControl("YourUserControlID");  
       
      TextBox   tb   =   (TextBox)   c.FindControl("YourTextBoxIDInYourUserControl);  
      tb.Text   =   "123";  
       
      >>>2、如何在后台设置和获取用户控件本身的属性?  
       
      if   you   have   a   codebehind   class   for   your   usercontrol,   you   can   do  
      protected   YourUserControlCodeBehindClass   YourUserControlID;  
       
      YourUserControlID.Property1   =   "123";  
       
      otherwise,   you   have   to   use   Reflection
  • 相关阅读:
    win7下cygwin命令行颜色和中文乱码解决
    maven mirror
    maven命令
    dubbo获取错误ip
    eclipse netbeans 代码模板
    windows下配置Groovy
    c++ 载入内存中dll ,以及内存注入
    表达式求值的 计算器
    vc 编译器的一些精典报错
    内联汇编实现 memcpy 和 memset
  • 原文地址:https://www.cnblogs.com/zgqys1980/p/404357.html
Copyright © 2011-2022 走看看