Go to Google ? Not for action, but for static link...">

Html a tag helper

there is an assistant in asp.net MVC3

<a href="www.google.com">Go to Google </a>

?

Not for action, but for static link

+3
source share
1 answer

I do not believe that there is, but I am not sure why you need it. You will actually get more code:

<a href="http://www.google.com/">Go to Google</a>

<%: Html.Link("http://www.google.com/", "Go to Google") %>

@Html.Link("http://www.google.com/", "Go to Google")

Update: . If you want to create an assistant Link(), as described above, you must use the extension method:

 public static class LinkExtensions
 {
    public static MvcHtmlString Link(this HtmlHelper helper, string href, string text)
    {
        var builder = new TagBuilder("a");
        builder.MergeAttribute("href", href);
        builder.SetInnerText(text);

        return MvcHtmlString.Create(builder.ToString(TagRenderMode.Normal));
    }
 }
+3
source

All Articles