Possible Duplicate:
Why in ASP.NET is a button click event executes when page is refreshed?
I want the code to avoid button click event from firing when page refresh occurs, i can not give response.redirect as i have some labels to be displayed after the button click event occurs.
Is there any chance that i can find out weather the page is page refresh from code behind in .cs ?
Thanks in advance
You can redirect to the same page, passing some parameters by query string, indicating that the operation has been succesfully (or not), and then display the appropiate message in your labels.
I’d not recommend a Session state approach, due this is could be problematic if the user has several tabs for the same page.
Also keep in mind that if you reload the page, it will be a new request, therefore the Page.IsPostack is useless cause it always will be false.