Reputation: 2066
I'm trying to make some changes in an Visual Studio 2008 MVC 1 code, and as I have just dealt so far with MVC 3, by the way far from beeing a beginner, I'm struggling with this problem:
Giving I have a viewmodel like this, where putting the List inside the User class itself seems to me nonsense.
public class Register {
public User User { get; set; }
public List<Options> Options{ get; set; }
}
Would anyone tell me how, in MVC 1, in a view strong typed with the previous model could I access the User properties, ie I'm trying for example
<div class ="row">
<label>Mobile telephone</label>
<%= Html.TextBox("Model.User.MobileTel")%>
</div>
but it doesn't populate the fields when reaching the post method in the controller.
Thanks in advance
Upvotes: 1
Views: 920
Reputation: 5197
Remove the "Model." from the name.
<%= Html.TextBox("User.MobileTel") %>
or
<%= Html.TextBoxFor(m => m.User.MobileTel) %>
Upvotes: 2