Home All Groups Group Topic Archive Search About

data inserted again after refresh

Author
18 Aug 2006 1:38 PM
SOW Olivier
Hi,

I'm begin in ASP.NET.
I use a gridView and DetailView in a same page,

I add a button which set DetailView in InsertMode.
When i click insert button in the DetailView, data are stored fine in my DataBase.

But if I refresh the page juste after the insert, data are inserted again in the Database.

When I worked with ASP3 in this case, i just do a redirection after inserting data with:
Response.Redirect(Request.Path+"?insert=1")

But if i do that with ASP.NET, when i select a next page in the GridView, insert=1 stay in the QueryString.

I'm sure i don't use the correct way to forbid double insert, can someone help ?

many thanx

Author
21 Aug 2006 12:11 AM
Muhammad Mosa
Set the SmartNavigation of your Page to true, this will enable your to
referesh the page without posting your data back .
it is working in both ASP.Net 1.x & ASP.NET 2.0 but I'm not sure if it will
be supporeted in next releases or they will replace it with something else
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications


Show quoteHide quote
"SOW Olivier" wrote:

> Hi,
>
> I'm begin in ASP.NET.
> I use a gridView and DetailView in a same page,
>
> I add a button which set DetailView in InsertMode.
> When i click insert button in the DetailView, data are stored fine in my DataBase.
>
> But if I refresh the page juste after the insert, data are inserted again in the Database.
>
> When I worked with ASP3 in this case, i just do a redirection after inserting data with:
> Response.Redirect(Request.Path+"?insert=1")
>
> But if i do that with ASP.NET, when i select a next page in the GridView, insert=1 stay in the QueryString.
>
> I'm sure i don't use the correct way to forbid double insert, can someone help ?
>
> many thanx
>
>
>
Author
19 Sep 2006 1:55 PM
hasan.ozdil
SmartNavigation is now obsolete... what is the new directive ? They say
in the msdn that mainscrollposition and setfocus are the new properties
but they doesn't affect the "multi insert" problem when clicking on the
refresh button

Have you an idea of the new property that avoids this problem?

Muhammad Mosa a écrit :

Show quoteHide quote
> Set the SmartNavigation of your Page to true, this will enable your to
> referesh the page without posting your data back .
> it is working in both ASP.Net 1.x & ASP.NET 2.0 but I'm not sure if it will
> be supporeted in next releases or they will replace it with something else
> --
> Muhammad Mosa
> Software Engineer & Solution Developer
> MCT/MCSD.NET
> MCTS: .Net 2.0 Web Applications
> MCTS: .Net 2.0 Windows Applications
>
>
> "SOW Olivier" wrote:
>
> > Hi,
> >
> > I'm begin in ASP.NET.
> > I use a gridView and DetailView in a same page,
> >
> > I add a button which set DetailView in InsertMode.
> > When i click insert button in the DetailView, data are stored fine in my DataBase.
> >
> > But if I refresh the page juste after the insert, data are inserted again in the Database.
> >
> > When I worked with ASP3 in this case, i just do a redirection after inserting data with:
> > Response.Redirect(Request.Path+"?insert=1")
> >
> > But if i do that with ASP.NET, when i select a next page in the GridView, insert=1 stay in the QueryString.
> >
> > I'm sure i don't use the correct way to forbid double insert, can someone help ?
> >
> > many thanx
> >
> >
> >