日期:2014-05-17 浏览次数:20528 次
if (this.itemsArray != null)
{
this.itemsArray.Clear();
}
else
{
this.itemsArray = new ArrayList();
}
if (!useDataSource)
{
dataItemCount = (int) this.ViewState["_!ItemCount"];
if (dataItemCount != -1)
{
data = new DummyDataSource(dataItemCount);
this.itemsArray.Capacity = dataItemCount;
}
}
else
{
data = this.GetData();
ICollection is2 = data as ICollection;
if (is2 != null)
{
this.itemsArray.Capacity = is2.Count;
}
}
if (data != null)
{
int itemIndex = 0;
bool flag = this.separatorTemplate != null;
dataItemCount = 0;
if (this.headerTemplate != null)
{
this.CreateItem(-1, ListItemType.Header, useDataSource, null);
}
foreach (object obj2 in data)
{
if (flag && (dataItemCount > 0))
{
this.CreateItem(itemIndex - 1, ListItemType.Separator, useDataSource, null);
}
ListItemType itemType = ((itemIndex % 2) == 0) ? ListItemType.Item : ListItemType.AlternatingItem;
RepeaterItem item = this.CreateItem(itemIndex, itemType, useDataSource, obj2);
this.itemsArray.Add(item);
dataItemCount++;
itemIndex++;
}
if (this.footerTemplate != null)
{
this.CreateItem(-1, ListItemType.Footer, useDataSource, null);
}
}