// NOTE: pages that use this control and need to assign its properties (e.g. AssetManagerId, AccountNumber, AccountName) // should do it AFTER the page is loaded, otherwise the assignments may not take effect (call DataBind() first, if necessary) protected void Page_Load(object sender, EventArgs e) { if (CurrentLoginType == LoginTypes.Customer) throw new SecurityLayerException(); WebControl[] controls = new WebControl[] { ddlAssetManager, ddlRemisier, ddlRemisierEmployee, ddlModelPortfolio, txtAccountNumber, txtAccountName, cbAccountStatusActive, cbAccountStatusInactive, cbEmailStatusYes, cbEmailStatusNo, ddlLoginStatus }; if (!IsDataBound) DataBind(); if (ShowSearchButton) foreach (WebControl control in controls) Utility.SetDefaultButton(Page, control, btnSearch); if (!IsPostBack) controls.First(c => c.Visible && c.Enabled).Focus(); }