public override void InitializeCell(System.Web.UI.WebControls.TableCell cell, int index, CartGridItem item)
 {
     base.InitializeCell (cell, index, item);
     if (item.ItemType == ListItemType.Item)
     {
         ITemplate content = itemTemplate;
         if (content != null) // Test if Skin mode
         {
             content.InstantiateIn(cell);
         }
     }
 }
 public override void InitializeCell(System.Web.UI.WebControls.TableCell cell, int index, CartGridItem item)
 {
     base.InitializeCell (cell, index, item);
     if (item.ItemType == ListItemType.Item)
     {
         LinkButton button = new LinkButton();
         button.CommandName = "Delete";
         button.CommandArgument = item.Item.Id.ToString();
         button.Command += new CommandEventHandler(button_Command);
         button.Text = this.Text;
         cell.Controls.Add(button);
     }
 }
Exemplo n.º 3
0
        protected virtual void CreateControlHierarchy()
        {
            Context.Trace.Write("CartGrid","CreateChildControls");

            Controls.Clear();

            if (Cart.Count == 0)
            {
                if (EmptyCartTemplate != null)
                {
                    Control c = new Control();
                    EmptyCartTemplate.InstantiateIn(c);
                    Controls.Add(c);
                }
                return;
            }

            if (HeaderTemplate != null)
            {
                Control c = new Control();
                HeaderTemplate.InstantiateIn(c);
                Controls.Add(c);
            }

            Table table = new Table();

            Controls.Add(table);

            // Create Header
            CartGridItem item = new CartGridItem(ListItemType.Header, null,Columns);
            InitializeItem(item);
            table.Rows.Add(item);

            // Bind CartItems
            for(int i=0; i < Cart.Count; i++)
            {
                CartGridItem cgItem = new CartGridItem(ListItemType.Item,Cart.SelectItemByIndex(i), Columns);
                cgItem.ID = "CartGridItem" + i;
                InitializeItem(cgItem);
                table.Rows.Add(cgItem);
                Items.Add(cgItem);
            }

            // Create Footer
            if (FooterTemplate != null)
            {
                TableCell cell = new TableCell();
                FooterTemplate.InstantiateIn(cell);
                cell.ColumnSpan = Columns.Count;
                TableRow row = new TableRow();
                row.Cells.Add(cell);
                table.Rows.Add(row);
            }
        }
Exemplo n.º 4
0
 protected virtual void InitializeItem(CartGridItem item)
 {
     TableCellCollection cells = item.Cells;
     TableCell cell;
     for(int i =0; i < Columns.Count; i++)
     {
         cell = new TableCell();
         Columns[i].InitializeCell(cell,i,item);
         cells.Add(cell);
     }
 }
Exemplo n.º 5
0
 public virtual void InitializeCell(TableCell cell, int index, CartGridItem item)
 {
     if (item.ItemType == ListItemType.Header)
     {
         InitializeCellHeader(cell , index);
     }
     else if(item.ItemType == ListItemType.Item)
     {
         cell.ApplyStyle(ItemStyle);
     }
 }