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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. problem postback

problem postback

Scheduled Pinned Locked Moved ASP.NET
databasehelpquestion
7 Posts 4 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.
  • M Offline
    M Offline
    momo007
    wrote on last edited by
    #1

    Hi everybody, i was wondering if we could execute the code in a button before the postback... because i need to save data from a placeholder in a database, before the postback of the page... can wa do that?? Thanks

    P 1 Reply Last reply
    0
    • M momo007

      Hi everybody, i was wondering if we could execute the code in a button before the postback... because i need to save data from a placeholder in a database, before the postback of the page... can wa do that?? Thanks

      P Offline
      P Offline
      Paddy Boyd
      wrote on last edited by
      #2

      This is possible using AJAX and call backs... However, why is this necessary? Is it not possible to fix this by putting an if not isPostBack in your page load method?

      M 1 Reply Last reply
      0
      • P Paddy Boyd

        This is possible using AJAX and call backs... However, why is this necessary? Is it not possible to fix this by putting an if not isPostBack in your page load method?

        M Offline
        M Offline
        momo007
        wrote on last edited by
        #3

        so if i want to use ajax like you said, can you tell me plz the event in javascript that i should work with if i want to use a button? for example, if i used a dropdownlist, i have to use onchange.. thanks for the reply

        P 1 Reply Last reply
        0
        • M momo007

          so if i want to use ajax like you said, can you tell me plz the event in javascript that i should work with if i want to use a button? for example, if i used a dropdownlist, i have to use onchange.. thanks for the reply

          P Offline
          P Offline
          Paddy Boyd
          wrote on last edited by
          #4

          Um, onclick... But i have my doubts that you really need to do this... Unless you really have a need to perform this asynchronously like this, you shouldn't...

          M A 2 Replies Last reply
          0
          • P Paddy Boyd

            Um, onclick... But i have my doubts that you really need to do this... Unless you really have a need to perform this asynchronously like this, you shouldn't...

            M Offline
            M Offline
            momo007
            wrote on last edited by
            #5

            the thing is, i have a variable session that i increment each time i push the button... but the problem is that i have to add the controls in the load_page so i can't lose them.. so when i push the button like i said, the controls are being added again because the init and the load are executed before the button event.. see what i mean??

            B 1 Reply Last reply
            0
            • P Paddy Boyd

              Um, onclick... But i have my doubts that you really need to do this... Unless you really have a need to perform this asynchronously like this, you shouldn't...

              A Offline
              A Offline
              Amit Agarrwal
              wrote on last edited by
              #6

              hi paddy i'm facing the same problem. actually my client don't want a postback of pages. as u said we can do this by Ajax.but i don't have any idea abt Ajax could u send me some code to perform this. u can reply me on amit_avesh@yahoo.co.in thanx Aavesh

              1 Reply Last reply
              0
              • M momo007

                the thing is, i have a variable session that i increment each time i push the button... but the problem is that i have to add the controls in the load_page so i can't lose them.. so when i push the button like i said, the controls are being added again because the init and the load are executed before the button event.. see what i mean??

                B Offline
                B Offline
                BoneSoft
                wrote on last edited by
                #7

                in your load_page wrap your control adding logic inside a

                if (!IsPostback) {
                // Add controls
                }

                So it only executes when it's not a postback. Problem solved. Visit BoneSoft.com

                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