Created
November 2, 2011 19:37
-
-
Save arviman/1334654 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int itemsPerPage = 2; | |
private CurrentProperties _CurrentProps = new CurrentProperties(); | |
[Serializable()] | |
private struct CurrentProperties | |
{ | |
public int RowCount; | |
public int CurrentPage; | |
} | |
//total no. of items | |
[DefaultValue(0)] | |
[NotifyParentProperty(true)] | |
public int RowCount | |
{ | |
get | |
{ | |
return _CurrentProps.RowCount; | |
} | |
set | |
{ | |
_CurrentProps.RowCount = value; | |
SaveControlState(); | |
} | |
} | |
//current page | |
[DefaultValue(1)] | |
[NotifyParentProperty(true)] | |
private int CurrentPage | |
{ | |
get | |
{ | |
return _CurrentProps.CurrentPage; | |
} | |
set | |
{ | |
_CurrentProps.CurrentPage = value; | |
SaveControlState(); | |
} | |
} | |
#region "Control state methods" | |
protected override void OnInit(System.EventArgs e) | |
{ | |
Page.RegisterRequiresControlState(this); | |
base.OnInit(e); | |
} | |
protected override object SaveControlState() | |
{ | |
return this._CurrentProps; | |
} | |
protected override void LoadControlState(object savedState) | |
{ | |
_CurrentProps = (CurrentProperties)savedState; | |
} | |
#endregion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment