Saving new records in MVC
Since I didn't get any replies in my previous question I will try to ask a more general one.
I have a table and class like that:
PK TeamID int;
FK CountryID int;
Name string
......
In my Create View I have textboxes for the Team table properties and a dropdown list of countries which is populated with values from another DB table.
The开发者_StackOverflow problem I am having is that I can't save new records because ModelState.IsValid always fails. Could someone help me with writing the POST Create method? I am using MVC 2. Thanks in advance.
Sounds like the validation in your view is failing for some reason. Have you checked for any javascript errors when you press submit? Firefox with firebug addon is handy for troubleshooting such things.
精彩评论