zoukankan      html  css  js  c++  java
  • FindControl

    Here is some C# code which should be easy to convert. Pass in the id "lblRecTonT" and the control collection Page.controls or GridView1.Controls. This is guaranteed to work if the ID exists.
    public static System.Web.UI.Control FindControl(string controlId, System.Web.UI.ControlCollection controls)
                {
                      for (int counter = 0; counter < controls.Count; ++counter) // loop through each control in the control collection
                      {
                            if (controls[counter].ID == controlId) //see if the current control is a match
                            {
                                  return controls[counter];
                            }
                            else if (controls[counter].Controls.Count > 0) // check the child controls
                            {
    System.Web.UI.Control FoundControl = FindControl(controlId, controls[counter].Controls); // recursive call to check child controls
                                  if (FoundControl != null) // control found in child's controls
                                  {
                                        return FoundControl;
                                  }
                            }
                      }
                      return null;
                }

    魔兽就是毒瘤,大家千万不要玩。
  • 相关阅读:
    【校招面试 之 C/C++】第1题 为什么优先使用构造函数的初始化列表
    Linux平台ORACLE INSTANT客户端安装
    ORACLE数据库链接
    ORACLE用户管理
    【转】软件开发工具介绍之 6.Web开发工具
    【转】三大UML建模工具Visio、Rational Rose、PowerDesign的区别
    ORACLE数据库查看执行计划
    数据分析方法
    ORACLE对象大小写问题
    计算机改名引发的ORA
  • 原文地址:https://www.cnblogs.com/tracy/p/1809159.html
Copyright © 2011-2022 走看看