1

I'm using a gridview and SQL data source .

After I'm inserting information in data table if I refresh the page the query is executed again and if I refresh it again it will execute again.

Is there any way to disable refresh or make the events unique to be executed only once when the event is raised without execution on refresh

Thanks

Jax
  • 977
  • 8
  • 22
  • 40

1 Answers1

2

if I understand correctly. You have a web form with a button.

You push the button which causes a post back and the event handler for the button press to execute.

Then you hit refresh and the page has the button event handler execute again.

The reason for this is your refreshing the last information sent to the server. Which is the button click information in the __doPostback. This is why you are seeing the event of the button fire again.

ASP.NET doesn't provide a way to do it directly.

Here is an Article talking about how to detect a refresh over a postback. and your issue is discussed here on other thread

Community
  • 1
  • 1
Talha
  • 18,898
  • 8
  • 49
  • 66
  • @Jax sorry i did not understand your question at first, now i have edited the answer which address your problem – Talha Jun 01 '12 at 07:32