Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. refresh problem

refresh problem

Scheduled Pinned Locked Moved ASP.NET
databasesql-serversysadminhelpquestion
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fouad888
    wrote on last edited by
    #1

    i have a button that is contain the code that call the stored procedure . the stored procedure is execute insert sql statment and add record to the data base that is in sql server . when i pressed the button the record is added well and go to the database. the problem is when i click refresh for the browser on this page the record is added again on the database . why & how can solve this problem ?

    dead

    _ Y 2 Replies Last reply
    0
    • F fouad888

      i have a button that is contain the code that call the stored procedure . the stored procedure is execute insert sql statment and add record to the data base that is in sql server . when i pressed the button the record is added well and go to the database. the problem is when i click refresh for the browser on this page the record is added again on the database . why & how can solve this problem ?

      dead

      _ Offline
      _ Offline
      _AK_
      wrote on last edited by
      #2

      What happens is when an event gets fired(postback) the event source gets stored and when you clicks on the refresh button then the event gets again fired. One simple way to get rid of the problem is to redirect to the same page after execution of the event.

      Best Regards, Apurva Kaushal

      F 1 Reply Last reply
      0
      • _ _AK_

        What happens is when an event gets fired(postback) the event source gets stored and when you clicks on the refresh button then the event gets again fired. One simple way to get rid of the problem is to redirect to the same page after execution of the event.

        Best Regards, Apurva Kaushal

        F Offline
        F Offline
        fouad888
        wrote on last edited by
        #3

        thank you this is working well but the sqldatasource that read from database is dont work when i click refresh and i need to show the last data record inserted . can i do this ?

        dead

        _ 1 Reply Last reply
        0
        • F fouad888

          thank you this is working well but the sqldatasource that read from database is dont work when i click refresh and i need to show the last data record inserted . can i do this ?

          dead

          _ Offline
          _ Offline
          _AK_
          wrote on last edited by
          #4

          If i have understood your problem correctly then after inserting the data into the database you want to display the inserted data to the user. If this is the case then you can't directly redirect to the same page you send some value in the querystring and then in the load event of the page just check the querystring value if it is present then get the newly inserted data and display it. Hope it will serve the purpose.

          Best Regards, Apurva Kaushal

          F 1 Reply Last reply
          0
          • _ _AK_

            If i have understood your problem correctly then after inserting the data into the database you want to display the inserted data to the user. If this is the case then you can't directly redirect to the same page you send some value in the querystring and then in the load event of the page just check the querystring value if it is present then get the newly inserted data and display it. Hope it will serve the purpose.

            Best Regards, Apurva Kaushal

            F Offline
            F Offline
            fouad888
            wrote on last edited by
            #5

            thank you for help >>> >>>

            dead

            _ 1 Reply Last reply
            0
            • F fouad888

              thank you for help >>> >>>

              dead

              _ Offline
              _ Offline
              _AK_
              wrote on last edited by
              #6

              always welcome.. :)

              Best Regards, Apurva Kaushal

              1 Reply Last reply
              0
              • F fouad888

                i have a button that is contain the code that call the stored procedure . the stored procedure is execute insert sql statment and add record to the data base that is in sql server . when i pressed the button the record is added well and go to the database. the problem is when i click refresh for the browser on this page the record is added again on the database . why & how can solve this problem ?

                dead

                Y Offline
                Y Offline
                YeHtut
                wrote on last edited by
                #7

                First way is U control duplicate data for DB level. Second way is U control the key event and take an action. As U like :)

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups