Form Closing Validation Problem
-
Hello Friends i Have 2 text box both have validation on validated event it work well but when user open form & direct press close button of form validate event fired first so , how i can prevent this validtion. :zzz:
-
Hello Friends i Have 2 text box both have validation on validated event it work well but when user open form & direct press close button of form validate event fired first so , how i can prevent this validtion. :zzz:
PriteshMalvan wrote:
both have validation on validated event
When are you firing this event ? i think you are doing on pageload .. Fire this event on submit button click if you have
Thanks and Regards Sandeep If you want something you never had, do something you have never done!
-
Hello Friends i Have 2 text box both have validation on validated event it work well but when user open form & direct press close button of form validate event fired first so , how i can prevent this validtion. :zzz:
You set the causevalidation property of the close button to false and it will work for you.
Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com My Blog Suggestions for me
-
PriteshMalvan wrote:
both have validation on validated event
When are you firing this event ? i think you are doing on pageload .. Fire this event on submit button click if you have
Thanks and Regards Sandeep If you want something you never had, do something you have never done!
Sandeep it is not related to pageload event. What exactly is happening is that when the user clicks on the close since all the validators are on so it fires the validation. So to avoid this you need to use the causevalidation property of the control. Set to false and things are done for you.
Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com My Blog Suggestions for me
-
Sandeep it is not related to pageload event. What exactly is happening is that when the user clicks on the close since all the validators are on so it fires the validation. So to avoid this you need to use the causevalidation property of the control. Set to false and things are done for you.
Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com My Blog Suggestions for me
i thought that he has written some javascript validation in some event i never made CausesValidation to true that might be reason Any way Thanks for showing right path
Thanks and Regards Sandeep If you want something you never had, do something you have never done!
-
Hello Friends i Have 2 text box both have validation on validated event it work well but when user open form & direct press close button of form validate event fired first so , how i can prevent this validtion. :zzz:
I think you are checking a null or empty value in your validation event. You should skip validation if the text is empty. Or you can add a bool _isClosing = false variable to your class and set it to true on Form.Vlosing event, then skip validation in your textboxes' validation event if _isClosing is true. Hope this helps.
-
Hello Friends i Have 2 text box both have validation on validated event it work well but when user open form & direct press close button of form validate event fired first so , how i can prevent this validtion. :zzz:
Send the piece of code. As i guess, your textboxes are empty when the use clicks close(X sign on to Form Titlebar) validation fails because you validate if the text entered in the textbox is empty or not, if empty fail the validation which vauses form to give focus to this textbox back instead of closing.