Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7593461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:10:30+00:00 2026-05-30T21:10:30+00:00

i have two asp:buttons.. say button1 and button2, what i would like to do

  • 0

i have two asp:buttons.. say button1 and button2, what i would like to do is fire button2’s click event when I click button1.. is there a way to trigger click event on an asp:button through code behind? please help, newbie here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:10:31+00:00Added an answer on May 30, 2026 at 9:10 pm

    Well, you can put the same event for both buttons, something like this:

    <asp:Button ID="btn1" runat="server" Text="Button 1" CommandName="Save" />
    <asp:Button ID="btn2" runat="server" Text="Button 2" CommandName="Cancel" />
    

    and in code behind (vb.net):

    Protected Sub btn_event(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn1.Click, btn2.Click
    
       Dim btn As Button = CType(sender, Button)
    
       'now you have the button instance on sender object, and you can check the ID property or CommandName property do solve what you want to do!
    
    End Sub
    

    C# code:

    protected void btn_event(object sender, EventArgs e) {
    
        Button btn = (Button)sender;
    
        //now you have the button instance on sender object, and you can check the ID property or CommandName property do solve what you want to do!
    
    }
    

    If you’re using C#, remember to set the event click on asp:button tag.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to have two radio buttons in my Asp.Net MVC3 App.There is no
What's the best way to have two websites (asp.net based) running on different domains
I'm learning asp.net. I have question about example buttons I can use two types
I have two radio buttons and two panels on my webpage and I would
For a site I'm developing I have two html buttons, not ASP because I
I'm using asp.net webGrid in which i have two buttons which both open same
I have to make a custom control made of two radio buttons in ASP
I have code below: <select id=testSelect> <option value=1>One</option> <option value=2>Two</option> </select> <asp:Button ID=btnTest runat=server
I have two ASP.NET sites (they can not run in the same process) and
I have two ASP.NET MVC web applications. One of them logs unhandled exceptions to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.