protected override void OnInit(EventArgs e) { ctrlGiftRegistryForm.ThisCustomer = ThisCustomer; ctrlGiftRegistryItemList.ThisCustomer = ThisCustomer; ctrlGiftRegistryItemListOptions.ThisCustomer = ThisCustomer; string urlRegistryId = string.Empty; btnSave.Click += (sender, ex) => SaveRegistry(); btnShowAllRegistry.Click += (sender, ex) => Response.Redirect("~/giftregistry.aspx"); btnShare.Click += (sender, ex) => { urlRegistryId = DomainConstants.GIFTREGISTRYPARAMCHAR.ToQueryStringDecode(); Response.Redirect(string.Format("~/sharegiftregistry.aspx?{0}={1}", DomainConstants.GIFTREGISTRYPARAMCHAR, urlRegistryId)); }; ctrlGiftRegistryForm.CustomURL = ThisCustomer.GenerateRandomCustomURLForGiftRegistry(); urlRegistryId = DomainConstants.GIFTREGISTRYPARAMCHAR.ToQueryStringDecode(); if (!urlRegistryId.IsNullOrEmptyTrimmed()) { //check if invalid registryid if (urlRegistryId.TryParseGuid().HasValue) { var giftRegistry = GiftRegistryFromQueryString; //check if invalid registryid if (giftRegistry == null) { RedirectToEditRegistry(); } //check if viewer is owner of the registry if (!this.ThisCustomer.IsRegistryOwnedByCustomer(urlRegistryId.TryParseGuid().Value)) { RedirectToEditRegistry(); } //unable to share if registry is not active if (giftRegistry.IsActive) { btnShare.Visible = true; } ctrlGiftRegistryForm.RegistryID = giftRegistry.RegistryID; ctrlGiftRegistryForm.IsEditMode = true; UpdatePreview(); LoadRegistry(giftRegistry); } } InitHeaderText(); base.OnInit(e); }