barnesco
asked on
How to have one onclick event execute the second onclick event
How would I have a button onclick event call another onclick event. It's hard to explain, but the onclick event arguments of one button is not the same as the onclick arguments of the other button due to each of the buttons being within different controls. I need the first button to act as an agent of the second button.
In the code behind, the first button has an argument of:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Execute the second button
End Sub
The second button has an event argument of:
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As Control.ViewUpdatedEventAr gs)
Do something...
End Sub
I need the first button to execute the second.
Thanks
In the code behind, the first button has an argument of:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Execute the second button
End Sub
The second button has an event argument of:
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As Control.ViewUpdatedEventAr
Do something...
End Sub
I need the first button to execute the second.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry for the late response.
I'm using a suite of proprietary controls (Telerik) where I need a button control (ByVal e As System.EventArgs) to call the proprietary telerik button command (ByVal e As Control.ViewUpdatedEventAr gs). What I don't know is the syntax of "MyButtonTwoCodeMethod()" as in:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
MyButtonTwoCodeMethod();
End Sub
Thanks.
I'm using a suite of proprietary controls (Telerik) where I need a button control (ByVal e As System.EventArgs) to call the proprietary telerik button command (ByVal e As Control.ViewUpdatedEventAr
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
MyButtonTwoCodeMethod();
End Sub
Thanks.
All you are doing in the click event is capturing the event, correct?
So if they click button1, then you want to execute some code, right?
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
MyButtonTwoCodeMethod();
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As Control.ViewUpdatedEventAr
MyButtonTwoCodeMethod();
AnyOtherMethodIwant();
End Sub
Can't you just call the same code when the button1 is clicked, instead of actually "clicking" the other button as well?