void DoItem(int i, ListItemType t, object d, bool databind) { RepeaterItem itm = CreateItem(i, t); if (t == ListItemType.Item || t == ListItemType.AlternatingItem) { items.Add(itm); } itm.DataItem = d; RepeaterItemEventArgs e = new RepeaterItemEventArgs(itm); InitializeItem(itm); // // It is very important that this be called *before* data // binding. Otherwise, we won't save our state in the viewstate. // Controls.Add(itm); OnItemCreated(e); if (databind) { itm.DataBind(); OnItemDataBound(e); } }
private void InstantiateEmptyTemplate() { if (itemsCreated == 0 && EmptyTemplate != null) { System.Web.UI.WebControls.RepeaterItem ri = new System.Web.UI.WebControls.RepeaterItem(0, System.Web.UI.WebControls.ListItemType.Header); EmptyTemplate.InstantiateIn(ri); Controls.Add(ri); OnItemCreated(new System.Web.UI.WebControls.RepeaterItemEventArgs(ri)); if (useDataSource) { ri.DataBind(); OnItemDataBound(new System.Web.UI.WebControls.RepeaterItemEventArgs(ri)); } } }
private void InstantiateEmptyTemplate() { if (itemsCreated == 0 && EmptyTemplate != null) { System.Web.UI.WebControls.RepeaterItem ri = new System.Web.UI.WebControls.RepeaterItem(0, System.Web.UI.WebControls.ListItemType.Header); EmptyTemplate.InstantiateIn(ri); Controls.Add(ri); OnItemCreated(new System.Web.UI.WebControls.RepeaterItemEventArgs(ri)); if (useDataSource) { ri.DataBind(); OnItemDataBound(new System.Web.UI.WebControls.RepeaterItemEventArgs(ri)); } } }
private RepeaterItem CreateItem(int itemIndex, ListItemType itemType, bool dataBind, object dataItem) { RepeaterItem item = this.CreateItem(itemIndex, itemType); RepeaterItemEventArgs e = new RepeaterItemEventArgs(item); this.InitializeItem(item); if (dataBind) { item.DataItem = dataItem; } this.OnItemCreated(e); this.Controls.Add(item); if (dataBind) { item.DataBind(); this.OnItemDataBound(e); item.DataItem = null; } return(item); }
private RepeaterItem CreateItem (int itemIndex, ListItemType itemType, bool dataBind, object dataItem) { RepeaterItem repeaterItem = new RepeaterItem (itemIndex, itemType); RepeaterItemEventArgs repeaterEventArgs = new RepeaterItemEventArgs (repeaterItem); InstantiateItem (repeaterItem); if (dataBind) repeaterItem.DataItem = dataItem; OnItemCreated (repeaterEventArgs); Controls.Add (repeaterItem); if (dataBind) { repeaterItem.DataBind (); OnItemDataBound (repeaterEventArgs); repeaterItem.DataItem = null; } return repeaterItem; }
private RepeaterItem CreateItem(int itemIndex, ITemplate template, ListItemType itemType, bool dataBind, object dataItem) { var item = new RepeaterItem(itemIndex, itemType); var e = new RepeaterItemEventArgs(item); template.InstantiateIn(item); if (dataBind) { item.DataItem = dataItem; } OnItemCreated(e); Controls.Add(item); if (dataBind) { item.DataBind(); OnItemDataBound(e); item.DataItem = null; } return item; }