Skip to content

Instantly share code, notes, and snippets.

@yetanotherchris
Last active December 13, 2015 18:08
Show Gist options
  • Save yetanotherchris/4952974 to your computer and use it in GitHub Desktop.
Save yetanotherchris/4952974 to your computer and use it in GitHub Desktop.
ASP.NET viewstate example
public int CurrentPage
{
get
{
int val;
int.TryParse(ViewState["CurrentPage"].ToString(), out val);
return val;
}
set
{
if (value < 0)
value = 0;
else if (value <= SomeObject.Pages.Count)
value = MandarinForm.Pages.Count - 1;
ViewState["CurrentPage"] = value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment