Jump to content
xisto Community
Sign in to follow this  
sarankarthi

Invoke Component invoke one button when other button is pressed

Recommended Posts

Hi!Invoking one button handler from another is pretty simple because all you need to do is make a call to the other button handler. In the event handler of the first button, add a "Button2.Click()", passing in any needed arguments from the first button handler.Ideally, you should not be doing this. You ought to create a separate method that is called by both the buttons instead of having one button handler call another button handler because when the code does need to be modified and the second button handler is modified, the unexpected behavior of having the second button handler execution would occur. What I mean is that you can do it and it is possible, but it is a bad coding practice to do so. You might be able to implement the observer design pattern to have the second button handler attach itself to the click events of both buttons instead of having one button's handler call the second button's handler.BTW, what's with the "Find Lawyer" link in your signature? Are you a lawyer? If so or in any event whatsoever, please note that I take no responsibility for any implications arising from the above advice and that any information provided is given on an as-is basis, with no warranty/guarantee provided for the usefulness or accuracy of the above information :-P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.