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;
                }

    魔兽就是毒瘤,大家千万不要玩。
  • 相关阅读:
    SQL 创建存储过程,让主键自增
    C# 实例练习(第二天)
    IT科技企业逻辑思维面试题
    C#学习——简介(第一天)
    C#中 ??、 ?、 ?: 、?.、?[ ]
    SQL Server类型与C#类型对应关系
    ios 键盘折叠
    html 水印效果
    JQuery筛选器全系列介绍
    将时间改为显示:几天前,几小时前,或者几分钟前
  • 原文地址:https://www.cnblogs.com/tracy/p/1809159.html
Copyright © 2011-2022 走看看