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