コード例 #1
0
 protected virtual void OnResolveControlID(ResolveControlEventArgs e)
 {
     if (ResolveControlID != null)
     {
         ResolveControlID(this, e);
     }
 }
コード例 #2
0
        protected Control FindControlHelper(string id)
        {
            Control c = null;

            if (_findControlHelperCache.ContainsKey(id))
            {
                c = _findControlHelperCache[id];
            }
            else
            {
                c = base.FindControl(id); // Use "base." to avoid calling self in an infinite loop
                Control nc = NamingContainer;
                while ((null == c) && (null != nc))
                {
                    c  = nc.FindControl(id);
                    nc = nc.NamingContainer;
                }
                if (null == c)
                {
                    // Note: props MAY be null, but we're firing the event anyway to let the user
                    // do the best they can
                    ResolveControlEventArgs args = new ResolveControlEventArgs(id);

                    OnResolveControlID(args);
                    c = args.Control;
                }
                if (null != c)
                {
                    _findControlHelperCache[id] = c;
                }
            }
            return(c);
        }