/// <summary> /// This helper automates locating a control by ID. /// /// It calls FindControl on the NamingContainer, then the Page. If that fails, /// it fires the resolve event. /// </summary> /// <param name="id">The ID of the control to find</param> /// <param name="props">The TargetProperties class associated with that control</param> /// <returns></returns> 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); }
protected virtual void OnResolveControlID(ResolveControlEventArgs e) { if (ResolveControlID != null) { ResolveControlID(this, e); } }
// Token: 0x06000063 RID: 99 RVA: 0x00002D34 File Offset: 0x00000F34 protected Control FindControlHelper(string id) { Control control; if (this.findControlHelperCache.ContainsKey(id)) { control = this.findControlHelperCache[id]; } else { control = base.FindControl(id); Control namingContainer = this.NamingContainer; while (control == null && namingContainer != null) { control = namingContainer.FindControl(id); namingContainer = namingContainer.NamingContainer; } if (control == null) { ResolveControlEventArgs resolveControlEventArgs = new ResolveControlEventArgs(id); this.OnResolveControlID(resolveControlEventArgs); control = resolveControlEventArgs.Control; } if (control != null) { this.findControlHelperCache[id] = control; } } return(control); }
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; }
protected void cbe_ResolveControlID(object sender, AjaxControlToolkit.ResolveControlEventArgs e) { if (e.ControlID == "LoginViewButton") { e.Control = LoginView1.FindControl(e.ControlID); AddMessage("cbe_ResolveControlID", e.ControlID); } }
protected void mpe_ResolveControlID(object sender, AjaxControlToolkit.ResolveControlEventArgs e) { // The Ajax stuff needs to be inside a different ContentPlaceHolder on the master page because otherwise the master page CSS breaks it. // The default Control Id resolution in ExtenderControlBase fails to find cmdDefer because it is contained inside a different ContentPlaceHolder // So they raise this event for me and I resolve it for them. switch (e.ControlID) { case "btnVote": e.Control = btnVote; break; } }