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. Insert multiple records

Insert multiple records

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasehelp
8 Posts 5 Posters 1 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.
  • M Offline
    M Offline
    Member 4260270
    wrote on last edited by
    #1

    Hi all, I have an asp.net page ,contains 3 textboxes ,1 dropdownlis,1 button. I have written the code for inserting data to the database inn the button click event.Its working properly,and cleared the textbox datas. But after inserting the datas, I clear the texts in the textboxes and set visible=false. Afetr this I tried to refresh the page,the above textbox values are again inserted into the database. If somebody knows about this ,pls help me. Thanks and Regards Denny

    M N L O 4 Replies Last reply
    0
    • M Member 4260270

      Hi all, I have an asp.net page ,contains 3 textboxes ,1 dropdownlis,1 button. I have written the code for inserting data to the database inn the button click event.Its working properly,and cleared the textbox datas. But after inserting the datas, I clear the texts in the textboxes and set visible=false. Afetr this I tried to refresh the page,the above textbox values are again inserted into the database. If somebody knows about this ,pls help me. Thanks and Regards Denny

      M Offline
      M Offline
      m dhu
      wrote on last edited by
      #2

      TextBox.Text=""; to clear data in text box...

      M 1 Reply Last reply
      0
      • M m dhu

        TextBox.Text=""; to clear data in text box...

        M Offline
        M Offline
        Member 4260270
        wrote on last edited by
        #3

        I have done already but still prob

        1 Reply Last reply
        0
        • M Member 4260270

          Hi all, I have an asp.net page ,contains 3 textboxes ,1 dropdownlis,1 button. I have written the code for inserting data to the database inn the button click event.Its working properly,and cleared the textbox datas. But after inserting the datas, I clear the texts in the textboxes and set visible=false. Afetr this I tried to refresh the page,the above textbox values are again inserted into the database. If somebody knows about this ,pls help me. Thanks and Regards Denny

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          The postback data won't be cleared and when you refresh, it will be resend. To work around this, consider redirecting the page after insert.

          // do insert
          Response.Redirect("success.aspx")

          Best wishes, Navaneeth

          M 1 Reply Last reply
          0
          • N N a v a n e e t h

            The postback data won't be cleared and when you refresh, it will be resend. To work around this, consider redirecting the page after insert.

            // do insert
            Response.Redirect("success.aspx")

            Best wishes, Navaneeth

            M Offline
            M Offline
            Member 4260270
            wrote on last edited by
            #5

            but sir,i have a grid in that page and i want to show the values in the grid

            1 Reply Last reply
            0
            • M Member 4260270

              Hi all, I have an asp.net page ,contains 3 textboxes ,1 dropdownlis,1 button. I have written the code for inserting data to the database inn the button click event.Its working properly,and cleared the textbox datas. But after inserting the datas, I clear the texts in the textboxes and set visible=false. Afetr this I tried to refresh the page,the above textbox values are again inserted into the database. If somebody knows about this ,pls help me. Thanks and Regards Denny

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              This is the way ASP.NET postback works. When you refresh, your browser submits the same page with the same postback information. The only way you can avoid it is by redirecting it to a different page.

              M 1 Reply Last reply
              0
              • L Lost User

                This is the way ASP.NET postback works. When you refresh, your browser submits the same page with the same postback information. The only way you can avoid it is by redirecting it to a different page.

                M Offline
                M Offline
                Member 4260270
                wrote on last edited by
                #7

                Thanks for you help

                1 Reply Last reply
                0
                • M Member 4260270

                  Hi all, I have an asp.net page ,contains 3 textboxes ,1 dropdownlis,1 button. I have written the code for inserting data to the database inn the button click event.Its working properly,and cleared the textbox datas. But after inserting the datas, I clear the texts in the textboxes and set visible=false. Afetr this I tried to refresh the page,the above textbox values are again inserted into the database. If somebody knows about this ,pls help me. Thanks and Regards Denny

                  O Offline
                  O Offline
                  Oakman
                  wrote on last edited by
                  #8

                  What do you mean when you say 'refresh the page?' How, exactly, are you doing that? Ignore any answers that suggest that viewstate will not contain the latest value inserted into a textbox, including string.empty. Without seeing rhe code it's hard to know, but it sounds like you may be rebinding those textboxes to your datastore.

                  Jon

                  Rob Graham wrote:

                  100% subsidies are very popular among the 50% of the population that pays no income tax...

                  Soap Box 1.0: the first, the original, reborn troll-less

                  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