title: Handling multiple submit button in form
body: <p>i was looking for good trick to handle multiple submit button in form and then i got some advice from this url and i followed but fail.
  <a href="https://stackoverflow.com/questions/442704/how-do-you-handle-multiple-submit-buttons-in-asp-net-mvc-framework">How do you handle multiple submit buttons in ASP.NET MVC Framework?</a></p>
  
  <p>posted by @Andrey Shchekin.</p>
  
  <p>he just said create a class like below one so i did in same controller</p>
  
  <pre><code>public class HttpParamActionAttribute : ActionNameSelectorAttribute {
      public override bool IsValidName(ControllerContext controllerContext, string actionName, MethodInfo methodInfo) {
          if (actionName.Equals(methodInfo.Name, StringComparison.InvariantCultureIgnoreCase))
              return true;
  
          if (!actionName.Equals("Action", StringComparison.InvariantCultureIgnoreCase))
              return false;
  
          var request = controllerContext.RequestContext.HttpContext.Request;
          return request[methodInfo.Name] != null;
      }
  } 
  </code></pre>
  
  <p>then multiple submit button in the view look like &amp; also controller code look like below</p>
  
  <pre><code>&lt;% using (Html.BeginForm("Action", "Post")) { %&gt;
    &lt;!— …form fields… --&gt;
    &lt;input type="submit" name="saveDraft" value="Save Draft" /&gt;
    &lt;input type="submit" name="publish" value="Publish" /&gt;
  &lt;% } %&gt; 
  
  and controller with two methods
  
  public class PostController : Controller {
      [HttpParamAction]
      [AcceptVerbs(HttpVerbs.Post)]
      public ActionResult SaveDraft(…) {
          //…
      }
  
      [HttpParamAction]
      [AcceptVerbs(HttpVerbs.Post)]
      public ActionResult Publish(…) {
          //…
      } 
  }
  </code></pre>
  
  <p>but when i test his code it never work. so any can tell me where i am making the mistake or code itself is wrong for handling the situation. thanks</p>