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

    魔兽就是毒瘤,大家千万不要玩。
  • 相关阅读:
    Python
    Python 学习之路
    Python 学习之路
    Python 学习之路
    Python 学习之路
    Python 学习之路
    Python 学习之路
    Python学习之路
    Python 学习之路
    Python 学习之路
  • 原文地址:https://www.cnblogs.com/tracy/p/1809159.html
Copyright © 2020-2023  润新知