Wednesday 15 September 2010

ASP.NET MVC Model Binding -


I was wondering if there was a way to force the price of an input field directly into the model with the value of the property Type model For example, let's say my model is an address object. I want to be able to say Html.Textbox (Model.Address1.State, "state", Model.Address1.State) . The first parameter will be the obvious asset that I want to bind to the model from the user, the second parameter will only be the DOM id and the third value will be the initial value of the input when I present the view.

I know that you can do Html.TextBox ("Address.State") and there is a custom binder that will create an address object for you and populate the state's property. . I need Html.Textbox (Model.Address1.State) .

Help?

I think that code to check the things that you want.


No comments:

Post a Comment