asp.net mvc strongly typed helpers - should your render binding object be the same as your posting object?

前端 未结 7 1437
刺人心
刺人心 2021-01-02 22:52

i see that asp.net mvc 2 has strongly typed helped and looking initially at the way it works i think maybe i am doing something wrong in asp.net mvc 1 in terms of data bindi

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-02 23:28

    I use a model for input (displayed by the form) and a separate model for output (posted by the form). Validation is placed on the output model. The specific reason why I do this is for drop down lists. You want a list of possible values to present to the user and these are in the input model. In the output or post from the form I don't want the list of possible value, I want to know what values the user selected, if any.

提交回复
热议问题