Validate model on initial request
-
I am returning a model to my view on the initial load of a page, the model is populated from the DB, I want to validate the model so that when the user receives the page a validation summary show the errors if any data in database is coming from ETL system so it can contain invalid data. whole point is to show error on page load to user if any rather than clicking on submit button and then showing errors
-
I am returning a model to my view on the initial load of a page, the model is populated from the DB, I want to validate the model so that when the user receives the page a validation summary show the errors if any data in database is coming from ETL system so it can contain invalid data. whole point is to show error on page load to user if any rather than clicking on submit button and then showing errors
I didn't see any questions in there.
-
I didn't see any questions in there.
-
That is a requirement. You still haven't ask a question.
-
That is a requirement. You still haven't ask a question.
-
Q is how to validate model on page load/or on HTTPGet request var uu=TryValidateModel(exceptionData); this always returns true and Model.IsValid return false only on post not on Get
You have shown no validation code. How can we tell what the actual issue with your code is?
-
I didn't see any questions in there.
That's being mean for the sake of it, Pete. The question is clearly 'how do I validate model on initial request?'. There may be issues with that question as your subsequent post points out (there's no code presented and we don't even know what platform is in play), but this post was unhelpful.
-
That's being mean for the sake of it, Pete. The question is clearly 'how do I validate model on initial request?'. There may be issues with that question as your subsequent post points out (there's no code presented and we don't even know what platform is in play), but this post was unhelpful.
BobJanova wrote:
That's being mean for the sake of it, Pete.
I'm sorry, but I have to disagree with you there. There is no question in the original post. If I were being mean, I'd have downvoted the post but I didn't. However, my point still stood, there was no question in there. Here's the post:
nitin_ion wrote:
I am returning a model to my view on the initial load of a page, the model is populated from the DB, I want to validate the model so that when the user receives the page a validation summary show the errors if any data in database is coming from ETL system so it can contain invalid data. whole point is to show error on page load to user if any rather than clicking on submit button and then showing errors
That is a requirement, not a question. Of course, I could have made assumptions as to what was supposed to have been asked, but they would have been assumptions. So, it's great that you have the benefit of the subsequent posts to get the context to judge me, but I didn't have that context. All I could see at that point was a request for someone to do the work and not a question on how to solve the problem.
-
I am returning a model to my view on the initial load of a page, the model is populated from the DB, I want to validate the model so that when the user receives the page a validation summary show the errors if any data in database is coming from ETL system so it can contain invalid data. whole point is to show error on page load to user if any rather than clicking on submit button and then showing errors
OK, so after reading this thread and figuring out (I hope!) what you're really trying to do, my question is WHY?? This is an out-bound model going to the client on a GET request, not a POST. Soooo, I fail to see why you have to validate a model your sending to the client?? If you have to do this, your business rules are messed up because the data in your model should ALWAYS be valid. You normally validate a model in-bound from the client, not out-bound. Yeah, I see the you said your data is coming from an ETL system, so, again, your business logic should be checking this, not your UI code.
A guide to posting questions on CodeProject
How to debug small programs
Dave Kreskowiak -
BobJanova wrote:
That's being mean for the sake of it, Pete.
I'm sorry, but I have to disagree with you there. There is no question in the original post. If I were being mean, I'd have downvoted the post but I didn't. However, my point still stood, there was no question in there. Here's the post:
nitin_ion wrote:
I am returning a model to my view on the initial load of a page, the model is populated from the DB, I want to validate the model so that when the user receives the page a validation summary show the errors if any data in database is coming from ETL system so it can contain invalid data. whole point is to show error on page load to user if any rather than clicking on submit button and then showing errors
That is a requirement, not a question. Of course, I could have made assumptions as to what was supposed to have been asked, but they would have been assumptions. So, it's great that you have the benefit of the subsequent posts to get the context to judge me, but I didn't have that context. All I could see at that point was a request for someone to do the work and not a question on how to solve the problem.
It's no less of a question than the one about TIFF and file copying just below. Okay, that one has 'How do I solve this problem?' explicitly, but whenever a thread starter is a description of a problem, that's the implicit question. It might be a bad implicit question, in which case tell the questioner what is wrong with it (or downvote and move on). Anyway, don't mean to start a fight about this but just stating my opinion on dealing with problem descriptions in these forums.