Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a function performing some task, i want to use this function after two times Page.Ispostback .....what code should i write...???


plz help............
Posted
Comments
Vin.k.S 2-Apr-13 8:29am    
You want the Hitcount or the Pageload Count ?

Store a variable in the Session, and increment it on each postback. Zero it on Page Load when not a postback.
MSDN: Session[^]
 
Share this answer
 
Comments
akrati shakya 2-Apr-13 3:38am    
Sir plz can you explain me in more brief or plz write the code...
OriginalGriff 2-Apr-13 3:43am    
How difficult do you think this is?
Did you read the link? It includes code fragments!
You already know how to test IsPostback, so why is this difficult for you?
Use Session and maintian a variale


Page_Load()
{

if(Ispostback)
{
// second time
if(session["PageLoadCount"] !=null && Convert.ToInt32(session["PageLoadCount"])<=2)
{
session["PageLoadCount"] = Conver.ToInt32(session["PageLoadCount"])+1;
}
else
{
// do whatever do u want.
}
}
else
{
// First time page request
session["PageLoadCount"] = 1
}


}
 
Share this answer
 
v2
Comments
akrati shakya 2-Apr-13 4:01am    
thanks you...
Its good, one more SHAKYA is here.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900