开发者

ASP.NET MVC Model Binding

I was wondering if there was a way to bind the value of an input field straight to the property in the Model through a strongly typed 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). So the first parameter would be the explicit property I want to bind to of the model with the value from the user, the second parameter would just be the DOM id, and the third value would be the initial value to input when I render the view.

I know you can do Html.TextBox("Address.State"开发者_高级运维) and have a custom binder which would create the Address object for you and populate the state property. I need Html.Textbox(Model.Address1.State).

Help?


I think the FluentHtml stuff from the mvccontrib code is what you may want to check out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜