data inserted again after refresh

Discussion in 'ASP .Net Web Controls' started by SOW Olivier, Aug 18, 2006.

  1. SOW Olivier

    SOW Olivier Guest

    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
    SOW Olivier, Aug 18, 2006
    #1
    1. Advertising

  2. 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
    >
    >
    >
    Muhammad Mosa, Aug 21, 2006
    #2
    1. Advertising

  3. SOW Olivier

    Guest

    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 :

    > 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
    > >
    > >
    > >
    , Sep 19, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2FrZXQgTXVuZHJh?=

    Temporarirly storing web form data to be inserted into Database ?

    =?Utf-8?B?U2FrZXQgTXVuZHJh?=, Mar 31, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    2,102
    Joseph Byrns
    Apr 1, 2005
  2. Replies:
    24
    Views:
    1,661
    alchemist
    Aug 4, 2005
  3. Jan
    Replies:
    5
    Views:
    1,126
  4. =?Utf-8?B?TWlrZQ==?=

    ASP.NET Postback Event Occurrs Again after page refresh

    =?Utf-8?B?TWlrZQ==?=, Apr 30, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    3,373
  5. Jan
    Replies:
    5
    Views:
    145
Loading...

Share This Page