ASP.NET MVC - Typesafe Html.TextBoxFor with different outputmodel
Posted
by BjartN
on Stack Overflow
See other posts from Stack Overflow
or by BjartN
Published on 2009-08-24T09:06:48Z
Indexed on
2010/06/02
14:14 UTC
Read the original article
Hit count: 151
asp.net-mvc
My view uses ModelX to render my HTML form and my controller action takes ModelY as input when saving the form. It seems the typesafe textbox API assumes I am using the same model in both places.
Is it possible to use different models and beeing type safe without creating my own helpers ?
<% = Html.TextBoxFor(x => x.Text) %>
I would like something like this. Does it exist ?
<% = Html.TextBoxFor<InputModel,OutputModel>(input=>input.Text, output=>output.SomeOtherText)
© Stack Overflow or respective owner