Asp.net MVC Label For
Posted
by Jaimal Chohan
on Stack Overflow
See other posts from Stack Overflow
or by Jaimal Chohan
Published on 2010-04-07T21:08:56Z
Indexed on
2010/04/07
21:13 UTC
Read the original article
Hit count: 412
asp.net-mvc-2
I have the following
<label for="Forename">Forename</label>
<%= Html.TextBoxFor(m => m.Customer.Name.Forename) %>
the problem with this is that this is rendered as
<label for="AddressLine1">Address Line 1</label>
<input type="text" value="" name="Customer.Address.Thoroughfare" id="Customer_Address_Thoroughfare">
not what I want ofc.
I would like an extension to render the label correctly (i.e. with the for="" attribute having the value of the input id), is there anything in MVC 2 that does this nativly before I go writing my own extension?
© Stack Overflow or respective owner