I'm trying print a custom attribute in a .cshtml view and I was reading this thread: asp.net mvc custom attributes
It's very simple.
My custom attribute
public class TitleAttribute : ActionFilterAttribute
{
protected string description;
public TitleAttribute(String descritionIn)
{
this.description = descritionIn;
}
public String Description
{
get
{
return this.description;
}
}
}
But this attribute can be used in different controllers and print this value in a shared layout.
HomeController
[Title("Start Page")]
public ActionResult Index()
{
return View();
}
RequestController
[Title("This page is releated with request")]
public ActionResult Index()
{
return View();
}
Is possible print the custom attribute value without use Reflection?