ASP.NET MVC 3 Model-binding and form fields

后端 未结 3 370
醉酒成梦
醉酒成梦 2020-12-31 18:05

I have an entity called Domain.Models.BlogPost which contains the following properties:

  • PostID
  • Title
  • Author
  • PostedDate<
3条回答
  •  抹茶落季
    2020-12-31 18:53

    Use ASP NET MVC templates so you have full control over what gets populated and it is type-safe.

    So you would create an .ascx template which takes a strongly typed Comment. In your model, you leave an empty one in there.

提交回复
热议问题