Asp.net MVC with Entity, using jquery to pass data into List. Does not work

…衆ロ難τιáo~ 提交于 2019-12-05 14:54:28
Tony

You have a bug in your NewAnswersRow partial view. Name and Id are the same in your html, however it is name that is passed in a form post. If you look at what MVC is doing, the name attribute of the answer text field is Answers[x].Answer, while the Id is Answers[x].AnswerText.

So change your name='Answers[@Model.AnswerId].AnswerText' to name='Answers[@Model.AnswerId].Answer' so it matches what MVC is expecting. Worked for me!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!