[EDIT] Ok, irony of ironies... Literally AS I was writing this, the MVC team at MS were putting out their latest version: MVC 2 RC 2. You can get it here (and yes, it fixes the problem I've described below): http://weblogs.asp.net/scottgu/archive/2010/02/05/asp-net-mvc-2-release-candidate-2-now-available.aspx
You'll notice, of course, that the above tends towards the opportunity rather than the specific. This is because the only output from the TryUpdateModel I've had is an error stating "Value cannot be null or empty. Parameter name 'name'." Woo hoo.
Anyway, fortunately there's lots of help on this subject, below... and hopefully my own solution, later...
- Researching the problem: http://stackoverflow.com/questions/1936970/asp-net-mvc-2-problem-with-updatemodel
- The solution to the problem: http://www.blogs.victorero.com/2010/01/21/UsingTheASPNETMVC20RCSourceCodeToCorrectABug.aspx
- How to get the code to fix the problem: http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=37423
- Stacktrace post linking to the source: http://stackoverflow.com/questions/1936970/asp-net-mvc-2-problem-with-updatemodel
And so, in the end, I've had my first look at downloading the source for an open MS framework and there are lots of things to be learnt in reading other organisation's code. It's an interesting project and doesn't have to be long and painful. Just grabbing a download and browsing should throw up an idea or two and hopefully show the right or wrong way of approaching things. Or, at the very least, a different way.
Also, I just wanted to point out that these are a great pair of posts:
- http://stackoverflow.com/questions/2131061/how-do-i-insert-an-element-into-xml-using-linq
- http://stackoverflow.com/questions/2193673/best-way-to-implement-an-asp-net-mvc-list-c
- And the blog post the link above links to: http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/
Also:
No comments:
Post a Comment