protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!IsPostBack)
            {
                DrpCurrencies.DataSource = CurrencyService.Instance.GetAll(StoreId);
                DrpCurrencies.DataBind();

                IEnumerable <DefaultCountry> defaultCountries = CountryService.Instance.GetDefaultCountries();

                DrpCountries.DataSource = defaultCountries;
                DrpCountries.DataBind();
            }
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!IsPostBack)
            {
                TemplateFileSelectorControl.LoadTemplateFiles();
                TemplateFileSelectionListControl.LoadTemplateFiles();

                TxtName.Text            = store.Name;
                DrpCountries.DataSource = CountryService.Instance.GetAll(store.Id);
                DrpCountries.DataBind();
                DrpCountries.SelectedValue = store.GeneralSettings.DefaultCountryId.ToString();

                DrpVatGroups.DataSource = VatGroupService.Instance.GetAll(store.Id);
                DrpVatGroups.DataBind();
                DrpVatGroups.SelectedValue = store.GeneralSettings.DefaultVatGroupId.ToString();

                DrpOrderStatuses.DataSource = OrderStatusService.Instance.GetAll(store.Id);
                DrpOrderStatuses.DataBind();
                DrpOrderStatuses.SelectedValue = store.GeneralSettings.DefaultOrderStatusId.ToString();

                DrpConfirmationEmail.DataSource = EmailTemplateService.Instance.GetAll(store.Id);
                DrpConfirmationEmail.DataBind();
                DrpConfirmationEmail.Items.TrySelectByValue(store.GeneralSettings.ConfirmationEmailTemplateId);

                DrpPaymentInconsistencyEmail.DataSource = EmailTemplateService.Instance.GetAll(store.Id);
                DrpPaymentInconsistencyEmail.DataBind();
                DrpPaymentInconsistencyEmail.Items.TrySelectByValue(store.GeneralSettings.PaymentInconsistencyEmailTemplateId);

                ChkPricesIsSpecifiedWithVat.Checked = store.GeneralSettings.PricesIsSpecifiedWithVat;

                ChkPersistOrderId.Checked = store.GeneralSettings.CookieTimeout != null;
                if (store.GeneralSettings.CookieTimeout != null)
                {
                    TxtOrderPersistanceTimeout.Text = store.GeneralSettings.CookieTimeout.Value.TotalMinutes.ToString("0");
                }

                TxtCartNumberPrefix.Text  = store.OrderSettings.CartNumberPrefix;
                TxtOrderNumberPrefix.Text = store.OrderSettings.OrderNumberPrefix;

                TxtProductPropertyAliases.Text           = string.Join(",", store.ProductSettings.ProductPropertyAliases);
                TxtProductUniquenessPropertyAliases.Text = string.Join(",", store.ProductSettings.ProductUniquenessPropertyAliases);

                IEnumerable <Store> stores             = StoreService.Instance.GetAll().ToList();
                IEnumerable <Store> stockSharingStores = stores.Where(s => s.ProductSettings.StockSharingStoreId == store.Id).ToList();
                PPnlStockSharingStore.Visible        = stores.Count() > 1;
                DrpStockSharingStore.Visible         = !stockSharingStores.Any();
                LblStockSharingStoreAssigned.Visible = !DrpStockSharingStore.Visible;

                if (!stockSharingStores.Any())
                {
                    foreach (Store store1 in stores)
                    {
                        if (store1.Id != store.Id)
                        {
                            bool hasAccessToStore = currentLoggedInUserPermissions != null && currentLoggedInUserPermissions.HasPermission(StoreSpecificPermissionType.AccessStore, store1.Id);

                            if (hasAccessToStore || store1.Id == store.ProductSettings.StockSharingStoreId)
                            {
                                DrpStockSharingStore.Items.Add(new ListItem((!hasAccessToStore ? "* " : "") + store1.Name, store1.Id.ToString(CultureInfo.InvariantCulture)));
                            }
                        }
                    }
                    DrpStockSharingStore.Items.TrySelectByValue(store.ProductSettings.StockSharingStoreId);
                }
                else
                {
                    LblStockSharingStoreAssigned.Text = string.Join(", ", stockSharingStores.Select(s => s.Name));
                }

                TxtGiftCardLength.Text    = store.GiftCardSettings.Length.ToString(CultureInfo.InvariantCulture);
                TxtGiftCardDaysValid.Text = store.GiftCardSettings.DaysValid.ToString(CultureInfo.InvariantCulture);
                TxtGiftCardPrefix.Text    = store.GiftCardSettings.Prefix;
                TxtGiftCardSuffix.Text    = store.GiftCardSettings.Suffix;

                TemplateFileSelectorControl.Items.TrySelectByValue(store.UISettings.EditOrderUiFile);
                TemplateFileSelectionListControl.Items.Cast <ListItem>().ToList().ForEach(i => i.Selected = store.UISettings.AllowedFilesForClientRendering.Contains(i.Value));
            }
        }