Esempio n. 1
0
        private TemplatedListItem CreateItem(Table table, int itemIndex, ListItemType itemType, bool dataBind, object dataItem)
        {
            TemplatedListItem          item = new TemplatedListItem(itemIndex, itemType);
            TemplatedListItemEventArgs e    = new TemplatedListItemEventArgs(item);

            if (itemTemplate != null)
            {
                itemTemplate.InstantiateIn(item.Cells[0]);
            }
            if (dataBind)
            {
                item.DataItem = dataItem;
            }
            OnItemCreated(e);
            table.Rows.Add(item);

            if (dataBind)
            {
                item.DataBind();
                OnItemDataBound(e);

                item.DataItem = null;
            }

            return(item);
        }
Esempio n. 2
0
        protected virtual void OnItemDataBound(TemplatedListItemEventArgs e)
        {
            TemplatedListItemEventHandler onItemDataBoundHandler = (TemplatedListItemEventHandler)Events[EventItemDataBound];

            if (onItemDataBoundHandler != null)
            {
                onItemDataBoundHandler(this, e);
            }
        }