Skip to content Skip to sidebar Skip to footer

How To Create Anchor Href Using Html.helper

Possible Duplicate: How to render plain HTML links in Asp.Net MVC loop? I want to create something like this Section Two using ASP.Net MVC's

Solution 1:

You could add your own helper for that:

publicstaticclassHtmlHelpers
{
    publicstaticstringSectionLink(this HtmlHelper html, string URL, string display)
    {
        return String.Format("<a href=\"{0}\">{1}</a>", URL, display);
    }
}

And you use it like this:

@Html.SectionLink(section.Anchor, section.Name)

Post a Comment for "How To Create Anchor Href Using Html.helper"