Groups | Blog | Home
all groups > asp.net > march 2007 >

asp.net : c#


amantech06 NO[at]SPAM gmail.com
3/29/2007 11:57:17 PM
Hi ,
i want to refresh the page and get different values from a for
loop , on each refresh
i m using ISPostback , and loop limit is 10
thx
Mark Rae
3/30/2007 12:00:00 AM
[quoted text, click to view]

if (!IsPostBack) // initial page load
{
ViewState["Counter"] = 1; // set up a counter in ViewState
}
else // postback
{
byte bytCounter = Convert.ToByte(ViewState["Counter"]);
if (bytCounter == 10)
{
// do something because the limit has been reached
}
else
{
bytCounter += 1;
ViewState["Counter"] = bytCounter;
}
}

AddThis Social Bookmark Button