Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have 3 textboxs namely TB1,TB2,TB3. All textboxs have TB_Validated events. When I run the code and place the cursor on TB2, the TB1_Validated event is triggered. This I could check with the help of debug breakpoint. What is the reason and how should it be solved?
Posted
Comments
Homero Rivera 1-Apr-14 0:30am    
Consider this...
TB2 nust have the same event assigned as TB1. Events are not attached to an object, on the contray, we attach objects to events. Therefore the same event can be triggered by 1000's of different objects.

You can have an event programmed after TB2, but TB2 may be assigned TB1's event.
S.Rajendran from Coimbatore 1-Apr-14 0:44am    
When I place the cursor on TB2 after form load why the event for TB1 is getting triggered?
It should not go to that event know?

What you observe is not an error: the Validated Event is raised when the Control loses focus, either by a keyboard action (like the user pressing the Tab key), or by mouse action as the user selects another Control, or by your code calling a method that changes the ActiveControl.

If you wish for the Validating, and Validated, events not to occur, then you can set the Control's 'CausesValidation property to 'false. Or you can write a Validating EventHandler and in its code set the e.Cancel property to 'true.

I suggest you study: [^], [^].
 
Share this answer
 
I think you have assigned TB1_Validated event to TB2 textbox.
Delete this TB1_Validated event, compile and assign TB_Validated event to TB2 textbox from property-event window.
 
Share this answer
 
Comments
S.Rajendran from Coimbatore 1-Apr-14 1:00am    
In property-event window I checked. Everything is OK. That is, TB1 has been assigned with TB1_Validated and TB2 with TB2 validated event respectively.
please remove OnTextChanged event from particular textbox property (aspx code) then event will not trigger.

if this not work then send your code. may be used some javascript or jquery used to call by pagemethod

Thanks
 
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