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. Button click event only working the second time

Button click event only working the second time

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdotnetsysadminhelp
4 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
    Mertli Ozgur Nevres
    wrote on last edited by
    #1

    Hi all, i am writing asp.net using .net framework 2.0 and vs2005. I have 2 buttons (both server side - save and cancel) buttons, 2 requiredfieldvalidators and 1 validationsummary on the page. Page is working correctly at this scenario: - Enter the page - Click "Cancel" button - Button click event works and program enters in btnCancel_Click function. My problem is occuring in the scenario below: - Enter the page - Click "Save" button - Validation summary says "Oppps - you didn't fill the required fields" - Click "Cancel" button - Nothing happens <- PROBLEM IS HERE - Click "Cancel" button AGAIN - Button click event works and program enters in btnCancel_Click function. Does anyone have any idea? Thanks

    ozgur.nevres

    N M S 3 Replies Last reply
    0
    • M Mertli Ozgur Nevres

      Hi all, i am writing asp.net using .net framework 2.0 and vs2005. I have 2 buttons (both server side - save and cancel) buttons, 2 requiredfieldvalidators and 1 validationsummary on the page. Page is working correctly at this scenario: - Enter the page - Click "Cancel" button - Button click event works and program enters in btnCancel_Click function. My problem is occuring in the scenario below: - Enter the page - Click "Save" button - Validation summary says "Oppps - you didn't fill the required fields" - Click "Cancel" button - Nothing happens <- PROBLEM IS HERE - Click "Cancel" button AGAIN - Button click event works and program enters in btnCancel_Click function. Does anyone have any idea? Thanks

      ozgur.nevres

      N Offline
      N Offline
      Nimit Patel
      wrote on last edited by
      #2

      http://www.codeproject.com/useritems/Multiple_form_submittion.asp[^] Visit this link. You will be get your requirement on this URL. Also rate it

      Nimit Patel

      1 Reply Last reply
      0
      • M Mertli Ozgur Nevres

        Hi all, i am writing asp.net using .net framework 2.0 and vs2005. I have 2 buttons (both server side - save and cancel) buttons, 2 requiredfieldvalidators and 1 validationsummary on the page. Page is working correctly at this scenario: - Enter the page - Click "Cancel" button - Button click event works and program enters in btnCancel_Click function. My problem is occuring in the scenario below: - Enter the page - Click "Save" button - Validation summary says "Oppps - you didn't fill the required fields" - Click "Cancel" button - Nothing happens <- PROBLEM IS HERE - Click "Cancel" button AGAIN - Button click event works and program enters in btnCancel_Click function. Does anyone have any idea? Thanks

        ozgur.nevres

        M Offline
        M Offline
        Marcus J Smith
        wrote on last edited by
        #3

        Check the Page_Load event. Usually when the button click is delayed it is because of something running outside of If Not IsPostBack.


        Cleako

        1 Reply Last reply
        0
        • M Mertli Ozgur Nevres

          Hi all, i am writing asp.net using .net framework 2.0 and vs2005. I have 2 buttons (both server side - save and cancel) buttons, 2 requiredfieldvalidators and 1 validationsummary on the page. Page is working correctly at this scenario: - Enter the page - Click "Cancel" button - Button click event works and program enters in btnCancel_Click function. My problem is occuring in the scenario below: - Enter the page - Click "Save" button - Validation summary says "Oppps - you didn't fill the required fields" - Click "Cancel" button - Nothing happens <- PROBLEM IS HERE - Click "Cancel" button AGAIN - Button click event works and program enters in btnCancel_Click function. Does anyone have any idea? Thanks

          ozgur.nevres

          S Offline
          S Offline
          Sam Heller
          wrote on last edited by
          #4

          Have you set validation group setting on all validators and save button? Sounds like the validator is still running on the cancel button which presumably you dont want to happen because the user has pressed cancel so the textbox values wont be used. The validation occurs when focus is taken of off the control to validate. So if you fill in an unvalidated control and then click on save, the validation event only occurs then. This also prevents the buttons click event from occurring and going back to the server. Therefore you must press the button again to continue

          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