Click here to Skip to main content
15,889,403 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear experts

I have one windows application and i am residing forms and user controls on different conditions in master page
My problem is that if i click some button on master page it should not execute validation of child control
Means if i validate textbox not to allow blank on leave event and if it is blank then even if i click master page button when that textbox is blank and control is in textbox it should get clicked without validating textbox
Posted
Comments
Prerak Patel 4-Jul-11 5:23am    
Master page in windows application?!!
mayur csharp G 4-Jul-11 5:28am    
consider MDI parent form
Sergey Alexandrovich Kryukov 4-Jul-11 16:57pm    
Add the tag: Forms, APS.NET, what?!
By the way, never use MDI! Don't get yourself in trouble and scare off customers. Use, say tabbed UI.
--SA

1 solution

You can't: The Validating event always happens before the Click event, so your validating handler has no way to know where the focus will end up and what will happen next.

The only way you could do anything like that is very messy: set a timer in the Validating event, and cancel it in the button click. If the timer elapses then do the actual validation. Nasty stuff. As a User, that would probably annoy me, as I use TAB to move between fields a lot and if I get there, I expect to be able to type immediately.

It might be better to consider using later validation for some fields - when the user clicks "OK" perhaps?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900