Link to home
Start Free TrialLog in
Avatar of barnesco
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.ViewUpdatedEventArgs)
           Do something...
        End Sub

I need the first button to execute the second.

Thanks

ASKER CERTIFIED SOLUTION
Avatar of Sammy
Sammy
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bthews
bthews

Forgive my ignorance of the situation, but I can't think of an example of why you would need to do this, at least on the serverside.

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.ViewUpdatedEventArgs)
           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?
Avatar of barnesco

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.ViewUpdatedEventArgs). 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.