Hi All ,Here i try to explain how to create Costume attribute and pass parameter to the costume attribute in mvc
Create a class which inherited from ActionFilterAttribute (or any filter classes)
{
public string name { get; set; }
public int id { get; set; }
public override void OnActionExecuting(ActionExecutingContext actionContext)
{
var actn = actionContext.ActionDescriptor.ActionName;
var cntrl = actionContext.ActionDescriptor.ControllerDescriptor.ControllerName;
}
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
base.OnActionExecuted(filterContext);
}
}
public ActionResult Index()
{
return View();
}
No comments:
Post a Comment