Reputation: 809
I'm capturing an external URL (string) in a form.
I want to pass this string to a view but transform it into a clickable link.
Currently I'm using this in the view which of course is just going to display my string. How do I turn it into a link?
@Html.DisplayFor(modelItem => item.Website)
Thanks.
Upvotes: 1
Views: 1888
Reputation: 53991
You can simply do:
<a href="@Model.Website">@Model.Website</a>
or for a list of urls:
@foreach(var url in Model.Websites)
{
<a href="@url">@url</a>
}
Upvotes: 2