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);

  }

 }

posted @ 2012-09-05 13:47  Loser0628  阅读(149)  评论(0编辑  收藏  举报