Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to have one onclick event execute the second onclick event

Posted on 2006-11-03
3
Medium Priority
?
206 Views
Last Modified: 2012-08-13
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

0
Comment
Question by:barnesco
3 Comments
 
LVL 27

Accepted Solution

by:
Sammy Ageil earned 1500 total points
ID: 17872445
Try using RaiseEvent EventName(arg1,arg2)
take a look here
http://www.codeproject.com/aspnet/ToggleControls.asp

HTH
0
 
LVL 1

Expert Comment

by:bthews
ID: 17883564
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?
0
 

Author Comment

by:barnesco
ID: 18047040
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.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question