Hi,
The problem exists even if I check Page.IsPostBack.
The following steps explains (I hope) my problem:
1)User clicks on a hyperlink.(The entry page loads ) so Page.IsPostBack is
False.
2)User enters values in respective textbox and clicks Save button. The page
posts back. Page.IsPostBack is true. Then it executes the Save
method.(Onclick event of the Save button) and finally renders the page.
3)User refreshes the browser. Now, again Page.IsPostBAck=true and the Save
method also gets executed.(The server thinks user has clicked the Save
button, but actually he has just refreshed the page).
Hope this explains the problem. I am sure everbody wouild have faced this. I
just need various techniques available to avoid this.
Thanks,
Ravi
"Frans Bouma [C# MVP]" wrote:
Ravi wrote: Hi,
I have a simple .aspx page where user enters data (e.g Name address,
etc). At the end, he/she clicks Save button which Posts to the same page and
in the Save button's click event I am saving the data into Database. Now
after saving the details the same page gets rendered to the user. If the user
refreshes the browser as its a post - back page the server is trying to store
the values again. what are the different possible ways to avoid this.
You can check if the page's code is run after a postback, with
Page.IsPostback.
FB
--
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------