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 7678703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:42:31+00:00 2026-05-31T17:42:31+00:00

I am trying to have two submit buttons in my form – one accepts

  • 0

I am trying to have two submit buttons in my form – one accepts meetings; the other declines them. They will both have different behaviours. How can I do is in my C# code?

The functionality I want is essentially

if(isPost) {
   if(//accept button pressed(Request.Form[???])) 
   {

   } 
   else 
   {


   }
}

Here is my HTML :

<button name="accept" type="submit">Accept</button>
<div class="spacer"></div>
<button name="decline" type="submit">Decline</button>
<div class="spacer"></div>

Simple enough, but I cannot find a test for this on the Internet or in any documentation. Does anyone know what I would have for this ?

  • 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-31T17:42:32+00:00Added an answer on May 31, 2026 at 5:42 pm

    Give each button element the same name (in this example, ‘SubmitButton’) but a different value, then do a check for the different values in your server code, ie:

    <button type="submit" name="SubmitButton" value="Accept">Accept</button>
    <button type="submit" name="SubmitButton" value="Decline">Decline</button>
    

    Then in your server code:

    string buttonClicked = Request.Form["SubmitButton"]
    if(buttonClicked == "Accept")
    {
        // Accept code
    }
    else if(buttonClicked == "Decline")
    {
        // Decline code
    }
    

    Be aware that this won’t work on some earlier versions of IE though, and you may have to do a little javascript on the client prior to the post request being made.

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

Sidebar

Related Questions

I have two classes one of which inherits from the other. Im trying to
I have a form with two buttons. I check which one is clicked at
I have two arrays of data that I'm trying to amalgamate. One contains actual
I am trying to have two input boxes, and a button which will update
i have a form element- text input and a submit button- Im trying to
I have a page with several forms. I am trying to submit one of
I have two divs, one inside the other and I would like the small
I'm trying a basic thing. I have two files: curl.php and form.php curl.php <?php
I have two PNGs that I am trying to combine into a PDF using
I have two named instances of SQL Server 2008 and am trying to set

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.