Click here to Skip to main content
15,899,663 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
how to detect the difference b/w page refreshing and first time page loading in asp.net

plz answer me
Posted

All you have to do is use the Page.IsPostBack method in your code behind. If it returns false, then you know that this is the initial page load.
 
Share this answer
 
Comments
Yusuf 10-Feb-11 15:07pm    
propose as Answer
Espen Harlinn 10-Feb-11 16:17pm    
My 5 - that's the usual way to do it :)
sabithaOrell 20-Apr-11 0:05am    
this is the answer for difference b/w submit and refresh

but in my problem in both page refreshing and first time page loading cases the Page.IsPostBack is true

thank u for replying me
There are a couple of ways you can achieve this, this is a good article - goto section 'Trap the Browser Refresh'

http://msdn.microsoft.com/en-us/library/ms379557%28VS.80%29.aspx[^]

Or you can use Session \ View State

http://blog.powerbrainsolutions.com/how-to-detect-page-refresh-using-asp-net[^]
 
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