Action选择器

用于asp.net Mvc3中一个页面提交到不同的Action

public class MultiButtonAttribute : ActionNameSelectorAttribute  {

  public string Name { get; set; }

  public MultiButtonAttribute(string name)   {

   this.Name = name;

  }

  public override bool IsValidName(ControllerContext controllerContext,

   string actionName, System.Reflection.MethodInfo methodInfo)   {

   if (string.IsNullOrEmpty(this.Name))    {

    return false;

   }

   return controllerContext.HttpContext.Request.Form.AllKeys.Contains(this.Name);

  }

 }

原文地址:https://www.cnblogs.com/eryang/p/2671792.html