protected void SaveSettingsButton_Click(object sender, EventArgs e) { var store = new CommerceSiteMappingStore(); foreach (RepeaterItem item in CatalogRepeater.Items) { var catalogIdHiddenField = item.FindControl("CatalogIdHiddenField") as HiddenField; var productTemplateDropDownList = item.FindControl("ProductTemplateDropDownList") as DropDownList; var productListTemplateDropDownList = item.FindControl("ProductListTemplateDropDownList") as DropDownList; int catalogId; if (int.TryParse(catalogIdHiddenField.Value, out catalogId)) { var mapping = store.Find(catalogId); if (mapping == null) { mapping = new CommerceSiteMapping(); mapping.CatalogId = catalogId; } int productListPageTypeId; if (int.TryParse(productListTemplateDropDownList.SelectedValue, out productListPageTypeId)) { mapping.CatalogNodePageTypeId = productListPageTypeId; mapping.FallbackPageTypeId = productListPageTypeId; } int productPageTypeId; if (int.TryParse(productTemplateDropDownList.SelectedValue, out productPageTypeId)) { mapping.CatalogEntryPageTypeId = productPageTypeId; } store.Add(mapping); } } }