I have created a Model class lets say Products. I want to have a property 'ItemName' return an HTML link everytime it is put into an HTML document. For example:
public class Product
{
int ItemID {get; private set;}
[HtmlReturn(Link=Html.ActionLink("Products", "Details", new {id=ItemID})] // <-- Something like this
int ItemName {get; private set;}
int Price {get; private set;}
}
Now anytime the ItemName is used in an HTML document, the value is output as a link to the Product/Details page for that item. This would allow output of the ItemName in many different locations with the assurance that it will always be a link anywhere it is referenced on a web site.