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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:26:48+00:00 2026-06-02T07:26:48+00:00

I followed the instructions on this post: Asp.net mvc3 razor with multiple submit buttons

  • 0

I followed the instructions on this post:
Asp.net mvc3 razor with multiple submit buttons
and here is my model:

public class AdminModel
{
  public string Command { get; set; }
}

My Controller

[HttpPost]
public ActionResult Admin(List<AdminModel> model)
{
   string s = model.Command;
}

My View

@using (Html.BeginForm("Admin", "Account"))
{
  <input type="submit" name="Command" value="Deactivate"/>
  <input type="submit" name="Command" value="Delete"/>
}

When I post back, string “s” is always null.

I also tried the second answer (the one with 146 votes) in this forum post : How do you handle multiple submit buttons in ASP.NET MVC Framework? and thats also null. What am I doing wrong?

  • 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-06-02T07:26:50+00:00Added an answer on June 2, 2026 at 7:26 am

    you need to take the value from their server side by the name of the button,

    public ActionResult Admin(List<AdminModel> model,string Command)
    {
       string s = Command;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is this possible? I've followed the instructions from here ( http://www.jetbrains.net/confluence/display/TCD4/Setting+up+an+External+Database#SettingupanExternalDatabase-MicrosoftSQLServer2005 ) but I
I followed these instructions here: http://w3schools.com/razor/razor_example.asp NOTE: I'm using Web Matrix The example said
i am trying to use urlrewriter.net and i followed instructions here but when i
Trying to debug into ASP.NET MVC 1.0 source, I followed instructions like these ,
I have followed the Accepted Answer's instructions from this post as regards creating a
I've followed instructions from this question on SO to set up RVM, rubies and
I've followed the instructions in this MSDN article: http://msdn.microsoft.com/en-us/library/dd206945.aspx Is it possible to call
I followed the instructions: create the bean. This bean is for an enum transferred
I've read through lots of threads on this, and followed the instructions at http://www.eventhelix.com/RealtimeMantra/HeaderFileIncludePatterns.htm
Pretty sure some people encountered this problem before. Followed all the instructions to setup

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.