//Modified the design for Mobile layout - converted to divs protected void rptCartItems_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { if (e.Item.DataItem is CartItem) { // details var item = e.Item.DataItem as CartItem; if (item.IsDownload || item.IsService) { var lblDownloadText = e.Item.FindByParse <Label>("lblDownloadText"); lblDownloadText.Text = AppLogic.GetString("checkoutshippingmult.aspx.7", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); lblDownloadText.Visible = true; } else { var ctrlAddressSelector = new AddressSelectorControl() { ID = "ctrlAddressSelector", AddressesDataSource = ThisCustomer.ShippingAddresses, SelectedAddressID = item.m_ShippingAddressID }; var litAddressContainer = e.Item.FindByParse <Panel>("pnlAddressSelector"); litAddressContainer.Controls.Add(ctrlAddressSelector); var ctrlAddNewAddress = new AddNewAddressControl() { ID = "ctrlAddNewAddress", AddNewCaption = AppLogic.GetString("checkoutshippingmult.aspx.cs.1", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), SaveCaption = AppLogic.GetString("checkoutshippingmult.aspx.cs.2", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), CancelCaption = AppLogic.GetString("checkoutshippingmult.aspx.cs.3", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) }; InitializeAddressControl(ctrlAddNewAddress.AddressControl); var pnlTrueAddressContainer = e.Item.FindByParse <Panel>("pnlTrueAddressContainer"); pnlTrueAddressContainer.Controls.Add(ctrlAddNewAddress); string textPostalDynamicName = "ajax_textbox" + item.ItemCounter; ctrlAddNewAddress.AddressControl.TextBoxWithStatePostalCodeCssClass = "inputTextBox " + textPostalDynamicName; string cboClass = "cboCountry_class_" + item.ItemCounter; ctrlAddNewAddress.AddressControl.CboCountry.CssClass = cboClass; //ctrlAddNewAddress.AddressControl.CboCountry.ClientIDMode = System.Web.UI.ClientIDMode.Static; //ctrlAddNewAddress.AddressControl.CboCountry.ID = dynamicComboBoxId; var script = new StringBuilder(); script.Append("<script type='text/javascript' >\n"); script.Append("$(document).ready(function(){\n"); script.AppendFormat("IniAddAddressUi('{0}', '{1}'); \n", textPostalDynamicName, cboClass); script.AppendFormat("var row = new ise.Controls.CheckOutShippingMultiItemRowControl();\n"); script.AppendFormat("row.setAddressSelectorcontrolId('{0}');\n", ctrlAddressSelector.ClientID); script.AppendFormat("row.setAddNewAddressControlId('{0}');\n", ctrlAddNewAddress.ClientID); script.Append(" });\n"); script.Append("</script>\n"); Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), script.ToString()); } } } }
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()); } } }