I want to store website addresses in a table in the database as either "http://some_website.com" or just as "some_website.com". Then in the view I have access to the text through "Model.Website". How can I generate a hyperlink? Is there a helper to do this?
Asked
Active
Viewed 1,587 times
1 Answers
2
Simply embed the model properties in a hyperlink element appropriately:
public class YourModel
{
public string Href { get; set; }
public string LinkText { get; set; }
}
...
<a href="@Model.Href">@Model.LinkText</a>

Moho
- 15,457
- 1
- 30
- 31