Solved

How to have one onclick event execute the second onclick event

Posted on 2006-11-03
3
198 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 earned 500 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

776 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