Solved

How to have one onclick event execute the second onclick event

Posted on 2006-11-03
3
203 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

617 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