Asp.net mvc 4 MVC 4 LabelFor extension combine text and url

Asp.net mvc 4 MVC 4 LabelFor extension combine text and url,asp.net-mvc-4,html.labelfor,Asp.net Mvc 4,Html.labelfor,I'm trying to build a form in MVC 4 that will have at the end a check box in the following format: _ |_| I agree to Terms & Conditions where Terms and Conditions are actual URLs to the terms and conditions pages. How I can Implement the @Html.LabelFor so that I can insert the two urls? If I understood it right can be achieved with an extension? EDIT: Or, I can just change the Display Attribute on my checkbox field to I agree to and then in my view use this or @Html.ActionL

I'm trying to build a form in MVC 4 that will have at the end a check box in the following format:

       _
      |_| I agree to Terms & Conditions

where

Terms
and
Conditions
are actual URLs to the terms and conditions pages.

How I can Implement the

@Html.LabelFor
so that I can insert the two urls? If I understood it right can be achieved with an extension?

EDIT:

Or, I can just change the Display Attribute on my checkbox field to

I agree to
and then in my view use this or
@Html.ActionLink
. Is this a good way?

@Html.LabelFor(m => m.AcceptTerms) <a href="http://www.google.com" target="_blank">Terms</a> &amp; <a href="http://www.google.com" target="_blank">Conditions</a>

#1

You could go "all in" and create a custom extension to handle your case, but if you're going to use this only in one or couple places, that would be unnecessary.

I'd just enclose the checkbox and the label text "manually" this way:

<label>
    @Html.CheckboxFor(m => m.AcceptTerms) 
    I agree to 
    <a href="http://www.google.com" target="_blank">Terms &amp; Conditions</a>
</label>

#2

I'd just do it manually like your example. When this becomes site-wide with more than a dozen then it becomes worth creating an extension.

#3

You can see here how do create your own HtmlHelper extensions.