return style;
}
- protected override int CreateChildControls (IEnumerable data, bool dataBinding)
+ protected override int CreateChildControls (IEnumerable dataSource, bool dataBinding)
{
- PagedDataSource dataSource = new PagedDataSource ();
- dataSource.DataSource = CurrentMode != DetailsViewMode.Insert ? data : null;
- dataSource.AllowPaging = AllowPaging;
- dataSource.PageSize = 1;
- dataSource.CurrentPageIndex = PageIndex;
+ PagedDataSource pagedDataSource = new PagedDataSource ();
+ pagedDataSource.DataSource = CurrentMode != DetailsViewMode.Insert ? dataSource : null;
+ pagedDataSource.AllowPaging = AllowPaging;
+ pagedDataSource.PageSize = 1;
+ pagedDataSource.CurrentPageIndex = PageIndex;
if (dataBinding && CurrentMode != DetailsViewMode.Insert) {
DataSourceView view = GetData ();
if (view != null && view.CanPage) {
- dataSource.AllowServerPaging = true;
+ pagedDataSource.AllowServerPaging = true;
if (SelectArguments.RetrieveTotalRowCount)
- dataSource.VirtualCount = SelectArguments.TotalRowCount;
+ pagedDataSource.VirtualCount = SelectArguments.TotalRowCount;
}
}
- bool showPager = AllowPaging && (dataSource.PageCount > 1);
+ bool showPager = AllowPaging && (pagedDataSource.PageCount > 1);
Controls.Clear ();
table = CreateTable ();
// Gets the current data item
if (AllowPaging) {
- PageCount = dataSource.DataSourceCount;
+ PageCount = pagedDataSource.DataSourceCount;
if (PageIndex >= PageCount && PageCount > 0)
- pageIndex = dataSource.CurrentPageIndex = PageCount - 1;
- if (dataSource.DataSource != null) {
- IEnumerator e = dataSource.GetEnumerator ();
+ pageIndex = pagedDataSource.CurrentPageIndex = PageCount - 1;
+ if (pagedDataSource.DataSource != null) {
+ IEnumerator e = pagedDataSource.GetEnumerator ();
if (e.MoveNext ())
dataItem = e.Current;
}
} else {
int page = 0;
object lastItem = null;
- if (dataSource.DataSource != null) {
- IEnumerator e = dataSource.GetEnumerator ();
+ if (pagedDataSource.DataSource != null) {
+ IEnumerator e = pagedDataSource.GetEnumerator ();
for (; e.MoveNext (); page++) {
lastItem = e.Current;
if (page == PageIndex)
if (showPager && PagerSettings.Position == PagerPosition.Top ||
PagerSettings.Position == PagerPosition.TopAndBottom) {
topPagerRow = CreateRow (-1, DataControlRowType.Pager, DataControlRowState.Normal);
- InitializePager (topPagerRow, dataSource);
+ InitializePager (topPagerRow, pagedDataSource);
table.Rows.Add (topPagerRow);
}
if (showPager && PagerSettings.Position == PagerPosition.Bottom ||
PagerSettings.Position == PagerPosition.TopAndBottom) {
bottomPagerRow = CreateRow (-1, DataControlRowType.Pager, DataControlRowState.Normal);
- InitializePager (bottomPagerRow, dataSource);
+ InitializePager (bottomPagerRow, pagedDataSource);
table.Rows.Add (bottomPagerRow);
}
}
return rstate;
}
- protected virtual void InitializePager (DetailsViewRow row, PagedDataSource dataSource)
+ protected virtual void InitializePager (DetailsViewRow row, PagedDataSource pagedDataSource)
{
TableCell cell = new TableCell ();
cell.ColumnSpan = 2;
if (pagerTemplate != null)
pagerTemplate.InstantiateIn (cell);
else
- cell.Controls.Add (PagerSettings.CreatePagerControl (dataSource.CurrentPageIndex, dataSource.PageCount));
+ cell.Controls.Add (PagerSettings.CreatePagerControl (pagedDataSource.CurrentPageIndex, pagedDataSource.PageCount));
row.Cells.Add (cell);
}
return dic;
}
- protected virtual void ExtractRowValues (IOrderedDictionary fieldValues, bool includeReadOnlyFields, bool includePrimaryKey)
+ protected virtual void ExtractRowValues (IOrderedDictionary fieldValues, bool includeReadOnlyFields, bool includeKeys)
{
foreach (DetailsViewRow row in Rows) {
if (row.Cells.Count < 1)
if (c != null)
c.ContainingField.ExtractValuesFromCell (fieldValues, c, row.RowState, includeReadOnlyFields);
}
- if (!includePrimaryKey && DataKeyNames != null)
+ if (!includeKeys && DataKeyNames != null)
foreach (string key in DataKeyNames)
fieldValues.Remove (key);
}
}
}
public
- void SetPageIndex (int newIndex)
+ void SetPageIndex (int index)
{
- DetailsViewPageEventArgs args = new DetailsViewPageEventArgs (newIndex);
+ DetailsViewPageEventArgs args = new DetailsViewPageEventArgs (index);
OnPageIndexChanging (args);
if (args.Cancel || !IsBoundUsingDataSourceID)
RequireBinding ();
}
- protected internal override void LoadControlState (object ob)
+ protected internal override void LoadControlState (object savedState)
{
- if (ob == null)
+ if (savedState == null)
return;
- object[] state = (object[]) ob;
+ object[] state = (object[]) savedState;
base.LoadControlState (state[0]);
pageIndex = (int) state[1];
pageCount = (int) state[2];
ControlStyle.LoadViewState (states [12]);
}
- void ICallbackEventHandler.RaiseCallbackEvent (string eventArgs)
+ void ICallbackEventHandler.RaiseCallbackEvent (string eventArgument)
{
- RaiseCallbackEvent (eventArgs);
+ RaiseCallbackEvent (eventArgument);
}
- protected virtual void RaiseCallbackEvent (string eventArgs)
+ protected virtual void RaiseCallbackEvent (string eventArgument)
{
- string[] clientData = eventArgs.Split ('|');
+ string[] clientData = eventArgument.Split ('|');
PageIndex = int.Parse (clientData[0]);
RaisePostBackEvent (clientData[1]);