Click here to Skip to main content
15,892,480 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I created a page to insert values using store procedure.

If I inserted the data and click on the submit button then the data is stored in data base, but when I refresh the page again, without going to any other page, the same value is inserted to the table.

Anybody can give the solution?
Posted
Updated 17-Nov-10 22:50pm
v2
Comments
Dalek Dave 18-Nov-10 4:50am    
Edited for Grammar and Syntax.

Have a look at these articles for similar issue:
Refresh Page Issue in ASP.Net[^]
Stop Refresh after Submitting your Request[^]
 
Share this answer
 
v2
Comments
thatraja 18-Nov-10 0:49am    
Just updated the broken URL in answer..Good Answer
Dalek Dave 18-Nov-10 4:50am    
Good Call.
Slacker007 18-Nov-10 6:55am    
yeah. what he said.
hi.

you must insert your code in below block.
page_load<br />
{<br />
if (!page.ispostback)<br />
{<br />
<br />
//insert your code here........<br />
<br />
}<br />
<br />
}


click here to get more information about page.ispostback
www.xefteri.com/articles/show.cfm?id=18
 
Share this answer
 
Make sure the insertion logic is written under

If(!Page.IsPostBack) Condition.
 
Share this answer
 
See that Your Insert Code is Placed in the
PageLoad{
(
if(!Page.IsPostBack)
{

}
}

and also write in the Button Submit
 
Share this answer
 
Comments
Hiren solanki 17-Nov-10 7:47am    
can't you see the answer is given above. why you are creating redundant answer.
Vigneshb6 17-Nov-10 23:54pm    
Mr. Hiren Solanki _______ . How can you think that your answer is accepted by the user may be he is not clear with your answer.
if your saying that creating a redundant answer then why did you gave the answer when it is already there. Don't feel like the owner of the code project buddy.
Hiren solanki 23-Nov-10 4:20am    
It's Chris only !!
Vigneshb6 23-Nov-10 8:56am    
If it's Chris then don't Unnecessarly give the Suggestions Mr. Hiren Solanki_____________.
you have to place your code of inserting inside
if(IsPostBack)<br />
{<br />
}<br />


if you have any problem then let me know with your code,
 
Share this answer
 
Comments
Hiren solanki 17-Nov-10 7:48am    
try to convey your answer, if it is different then others.
look at this:
[]
 
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