Hi,
i sometimes get an error with the UpdateModel function. However, i can't seem to locate the exact message which field(s) is/are causing the problem. For example this one: "The model of type 'Enquete' was not successfully updated."
it has an innerexception of NULL, and no further description. Is there a way to find out what is causing the problem?
Michel
EDIT: i see this in my output window: "A first chance exception of type 'System.InvalidOperationException' occurred in System.Web.Mvc.dll"
-
Steve Sanderson has a wonderful article on using the MVC source to help you debug your application.
I think this will help you get more info.
Kindness,
Dan
Michel : that indeed worked, but debugging the mvc source is not an easy thing (well, debugging is, but understanding it is another story) -
Just a wild guess: You are trying to bind
nullto a value type. Check in your model forint,float,DateTime,structs, ... data types that you try to bind tonull.Michel : i'll look into that, InvalidOperationException does give me a hint that way, you're right. So when i want to be absolutely sure there is no error i have to create a very 'loose' or 'forgiving' model in which you can place any data, and then validate that model and THEN i put it in my business model. Because when the user enters an empty value for a non-nullable int it raises an exception for UpdateModel(). This leaves me with an annoying update from the viewmodel to the businesmodel...
0 comments:
Post a Comment