protected void rptCartItems_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { bool isCartItem = (e.Item.DataItem is CartItem); if (!isCartItem) { return; } var item = e.Item.DataItemAs <CartItem>(); var trHeader = new TableRow(); var converter = new WebColorConverter(); trHeader.BackColor = (Color)converter.ConvertFrom("#" + AppLogic.AppConfig("LightCellColor")); // headers.. var tdItemNameHeader = new TableCell(); tdItemNameHeader.Width = Unit.Percentage(30); var lblItemNameHeader = new Label(); lblItemNameHeader.Text = string.Format("<b>{0}</b>", AppLogic.GetString("shoppingcart.cs.1", ThisCustomer.SkinID, ThisCustomer.LocaleSetting)); tdItemNameHeader.Controls.Add(lblItemNameHeader); trHeader.Cells.Add(tdItemNameHeader); var tdShipHeader = new TableCell(); tdShipHeader.Width = Unit.Percentage(70); var lblShipHeader = new Label(); lblShipHeader.Text = string.Format("<b>{0}</b>", AppLogic.GetString("shoppingcart.cs.24", ThisCustomer.SkinID, ThisCustomer.LocaleSetting)); tdShipHeader.Controls.Add(lblShipHeader); trHeader.Cells.Add(tdShipHeader); e.Item.Controls.Add(trHeader); // details var trDetail = new TableRow(); var tdDetailCaption = new TableCell() { Width = Unit.Percentage(30), VerticalAlign = VerticalAlign.Top, }; trDetail.Cells.Add(tdDetailCaption); var lblItemName = new Label() { Text = item.DisplayName }; tdDetailCaption.Controls.Add(lblItemName); var tdDetailAddNew = new TableCell() { Width = Unit.Percentage(70), VerticalAlign = VerticalAlign.Top }; trDetail.Cells.Add(tdDetailAddNew); e.Item.Controls.Add(trDetail); if (item.IsDownload || item.IsService) { var lblNoShippingRequired = new Label() { Text = AppLogic.GetString("checkoutshippingmult.aspx.7", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) }; tdDetailAddNew.Controls.Add(lblNoShippingRequired); tdDetailAddNew.Controls.Add(new LiteralControl("<br />")); tdDetailAddNew.Controls.Add(new LiteralControl("<br />")); } else { var ctrlAddressSelector = new AddressSelectorControl() { ID = "ctrlAddressSelector" }; var availableAddresses = new List <Address>(); availableAddresses.AddRange(ThisCustomer.ShippingAddresses); bool shouldNotContainingTheSameAddressId = !ThisCustomer.ShippingAddresses.Any(addressItem => addressItem.AddressID == item.m_ShippingAddressID && !item.GiftRegistryID.HasValue); if (item.GiftRegistryID.HasValue && shouldNotContainingTheSameAddressId) { var registryBillingAddress = ThisCustomer.GetRegistryItemShippingAddress(item.m_ShippingAddressID, item.GiftRegistryID); availableAddresses.Add(registryBillingAddress); availableAddresses.Reverse(); } ctrlAddressSelector.AddressesDataSource = availableAddresses; ctrlAddressSelector.SelectedAddressID = item.m_ShippingAddressID; tdDetailAddNew.Controls.Add(ctrlAddressSelector); var script = new StringBuilder(); script.Append("<script type=\"text/javascript\" language=\"Javascript\" >\n"); script.Append("$add_windowLoad(\n"); script.Append(" function() { \n"); script.AppendFormat(" var row = new ise.Controls.CheckOutShippingMultiItemRowControl();\n"); script.AppendFormat(" row.setAddressSelectorcontrolId('{0}');\n", ctrlAddressSelector.ClientID); script.Append(" }\n"); script.Append(");\n"); script.Append("</script>\n"); Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), script.ToString()); } } }