public bool Equals(System.Web.UI.WebControls.DataKey other) { return(default(bool)); }
protected override int CreateChildControls(IEnumerable dataSource, bool dataBinding) { PagedDataSource pagedDataSource = null; int pageIndex = this.PageIndex; bool allowPaging = this.AllowPaging; int count = 0; DetailsViewMode mode = this.Mode; if (base.DesignMode && (mode == DetailsViewMode.Insert)) { pageIndex = -1; } if (dataBinding) { DataSourceView data = this.GetData(); DataSourceSelectArguments selectArguments = base.SelectArguments; if (data == null) { throw new HttpException(System.Web.SR.GetString("DataBoundControl_NullView", new object[] { this.ID })); } if (mode != DetailsViewMode.Insert) { if ((allowPaging && !data.CanPage) && ((dataSource != null) && !(dataSource is ICollection))) { selectArguments.StartRowIndex = pageIndex; selectArguments.MaximumRows = 1; data.Select(selectArguments, new DataSourceViewSelectCallback(this.SelectCallback)); } if (this._useServerPaging) { if (data.CanRetrieveTotalRowCount) { pagedDataSource = this.CreateServerPagedDataSource(selectArguments.TotalRowCount); } else { ICollection is2 = dataSource as ICollection; if (is2 == null) { throw new HttpException(System.Web.SR.GetString("DataBoundControl_NeedICollectionOrTotalRowCount", new object[] { base.GetType().Name })); } pagedDataSource = this.CreateServerPagedDataSource(this.PageIndex + is2.Count); } } else { pagedDataSource = this.CreatePagedDataSource(); } } } else { pagedDataSource = this.CreatePagedDataSource(); } if (mode != DetailsViewMode.Insert) { pagedDataSource.DataSource = dataSource; } IEnumerator enumerator = null; OrderedDictionary keyTable = this.KeyTable; this._rowsArray = new ArrayList(); this._rowsCollection = null; if (!dataBinding) { enumerator = dataSource.GetEnumerator(); ICollection is3 = dataSource as ICollection; if (is3 == null) { throw new HttpException(System.Web.SR.GetString("DataControls_DataSourceMustBeCollectionWhenNotDataBinding")); } count = is3.Count; } else { keyTable.Clear(); if (dataSource != null) { if (mode != DetailsViewMode.Insert) { ICollection is4 = dataSource as ICollection; if (((is4 == null) && pagedDataSource.IsPagingEnabled) && !pagedDataSource.IsServerPagingEnabled) { throw new HttpException(System.Web.SR.GetString("DetailsView_DataSourceMustBeCollection", new object[] { this.ID })); } if (pagedDataSource.IsPagingEnabled) { count = pagedDataSource.DataSourceCount; } else if (is4 != null) { count = is4.Count; } } enumerator = dataSource.GetEnumerator(); } } Table child = this.CreateTable(); TableRowCollection rows = child.Rows; bool flag2 = false; object current = null; this.Controls.Add(child); if (enumerator != null) { flag2 = enumerator.MoveNext(); } if (!flag2 && (mode != DetailsViewMode.Insert)) { if ((pageIndex >= 0) || this.AutoGenerateRows) { if ((this.EmptyDataText.Length > 0) || (this._emptyDataTemplate != null)) { this._rowsArray.Add(this.CreateRow(0, DataControlRowType.EmptyDataRow, DataControlRowState.Normal, null, rows, null)); } count = 0; } } else { int num3 = 0; if (!this._useServerPaging) { while (num3 < pageIndex) { current = enumerator.Current; flag2 = enumerator.MoveNext(); if (!flag2) { this._pageIndex = num3; pagedDataSource.CurrentPageIndex = num3; pageIndex = num3; break; } num3++; } } if (flag2) { this._dataItem = enumerator.Current; } else { this._dataItem = current; } if ((!this._useServerPaging && !(dataSource is ICollection)) || (this._useServerPaging && (count < 0))) { count = num3; while (flag2) { count++; flag2 = enumerator.MoveNext(); } } this._dataItemIndex = num3; bool flag3 = (count <= 1) && !this._useServerPaging; if (((allowPaging && this.PagerSettings.Visible) && (this._pagerSettings.IsPagerOnTop && !flag3)) && (mode != DetailsViewMode.Insert)) { this._topPagerRow = this.CreateRow(-1, DataControlRowType.Pager, DataControlRowState.Normal, null, rows, pagedDataSource); } this._headerRow = this.CreateRow(-1, DataControlRowType.Header, DataControlRowState.Normal, null, rows, null); if ((this._headerTemplate == null) && (this.HeaderText.Length == 0)) { this._headerRow.Visible = false; } this._rowsArray.AddRange(this.CreateDataRows(dataBinding, rows, this._dataItem)); if (pageIndex >= 0) { string[] dataKeyNamesInternal = this.DataKeyNamesInternal; if (dataBinding && (dataKeyNamesInternal.Length != 0)) { foreach (string str in dataKeyNamesInternal) { object propertyValue = DataBinder.GetPropertyValue(this._dataItem, str); keyTable.Add(str, propertyValue); } this._dataKey = new System.Web.UI.WebControls.DataKey(keyTable); } } this._footerRow = this.CreateRow(-1, DataControlRowType.Footer, DataControlRowState.Normal, null, rows, null); if ((this._footerTemplate == null) && (this.FooterText.Length == 0)) { this._footerRow.Visible = false; } if (((allowPaging && this.PagerSettings.Visible) && (this._pagerSettings.IsPagerOnBottom && !flag3)) && (mode != DetailsViewMode.Insert)) { this._bottomPagerRow = this.CreateRow(-1, DataControlRowType.Pager, DataControlRowState.Normal, null, rows, pagedDataSource); } } this._pageCount = count; this.OnItemCreated(EventArgs.Empty); if (dataBinding) { this.DataBind(false); } return count; }