protected virtual void CreateControlHierarchy (bool useDataSource)
		{
			if (itemsArrayList != null) {
				itemsArrayList.Clear ();
			} else {
				itemsArrayList = new ArrayList ();
			}

			IEnumerable ds = null;
			if (useDataSource) {
				ds = GetResolvedDataSource ();
			} else {
				int itemCount  = (int) ViewState [ITEMCOUNT];
				if (itemCount != -1)
					ds = new DataSourceInternal (itemCount);
			}

			int index = 0;
			if (ds != null) {
				if (headerTemplate != null)
					CreateItem (-1, ListItemType.Header, useDataSource, null);
				
				bool even = true;
				foreach (object item in ds){
					if (separatorTemplate != null && index > 0)
						CreateItem (index - 1, ListItemType.Separator,
							    useDataSource, null);

					RepeaterItem repeaterItem;
					ListItemType lType;
					if (!even)
						lType = ListItemType.AlternatingItem;
					else
						lType = ListItemType.Item;

					repeaterItem = CreateItem (index, lType, useDataSource, item);
					itemsArrayList.Add (repeaterItem);
					index++;
					even = !even;
				}
				
				if (footerTemplate != null)
					CreateItem (-1, ListItemType.Footer, useDataSource, null);
			}

			if (useDataSource)
				ViewState [ITEMCOUNT] = (ds == null) ? -1 : index;
		}
		/// <summary>
		/// Undocumented
		/// </summary>
		protected override void CreateControlHierarchy (bool useDataSource)
		{
			IEnumerable source = null;
			ArrayList dkeys = DataKeysArray;

			if (itemsArray != null) {
				itemsArray.Clear ();
			} else {
				itemsArray = new ArrayList ();
			}

			extractTemplateRows = ExtractTemplateRows;
			if (!useDataSource) {
				int count = (int) ViewState ["_!ItemCount"];
				if (count != -1) {
					source = new DataSourceInternal (count);
					itemsArray.Capacity = count;
				}
			} else {
				dkeys.Clear ();
				source = GetResolvedDataSource ();
				if (source is ICollection) {
					dkeys.Capacity = ((ICollection) source).Count;
					itemsArray.Capacity = ((ICollection) source).Count;
				}
			}

			int itemCount = 0;
			if (source != null) {
				int index = 0;
				int editIndex = EditItemIndex;
				int selIndex = SelectedIndex;
				string dataKey = DataKeyField;
				
				if (headerTemplate != null)
					CreateItem (-1, ListItemType.Header, useDataSource, null);

				foreach (object current in source) {
					if (useDataSource) {
						try {
							dkeys.Add (DataBinder.GetPropertyValue (current, dataKey));
						} catch {
							dkeys.Add (dkeys.Count);
						}
					}

					ListItemType type = ListItemType.Item;
					if (index == editIndex) {
						type = ListItemType.EditItem;
					} else if (index == selIndex) {
						type = ListItemType.SelectedItem;
					} else if ((index % 2) != 0) {
						type = ListItemType.AlternatingItem;
					}

					itemsArray.Add (CreateItem (index, type, useDataSource, current));
					if (separatorTemplate != null)
						CreateItem (index, ListItemType.Separator, useDataSource, null);
					itemCount++;
					index++;
				}

				if (footerTemplate != null)
					CreateItem (-1, ListItemType.Footer, useDataSource, null);
			}

			if (useDataSource)
				ViewState ["_!ItemCount"] = (source != null ? itemCount : -1);
		}