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

    魔兽就是毒瘤,大家千万不要玩。
  • 相关阅读:
    bzoj2809 [Apio2012]dispatching
    bzoj2743[HEOI2012]采花
    bzoj3626[LNOI2014]LCA
    bzoj2038 [2009国家集训队]小Z的袜子(hose)——莫队
    bzoj2442[Usaco2011 Open]修剪草坪——单调队列优化
    bzoj1588[HNOI2002]营业额统计——双向链表
    洛谷1527(bzoj2738)矩阵乘法——二维树状数组+整体二分
    bzoj1503[NOI2004]郁闷的出纳员——Splay
    洛谷P2014——选课
    洛谷P1352——动规
  • 原文地址:https://www.cnblogs.com/tracy/p/1809159.html
Copyright © 2011-2022 走看看