Button click event only working the second time
-
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
-
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
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
-
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
Check the Page_Load event. Usually when the button click is delayed it is because of something running outside of
If Not IsPostBack
.
Cleako
-
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
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