Validations

Feb 26, 2011 at 4:22 PM

Hi,

I am trying your Person example to create a record.

I want to send back a validation message in case the person already exists, something like "person already exists" without the popupform disappearing. I want to display the message in a pop up when i click on submit.

I checked out the popformdemo. But it expects the messages to come with the model. 

Could you suggest as to how i can achieve this ?

Feb 26, 2011 at 4:33 PM

Hi,

you could create a custom validation attribute that would check this and everything is gonna work out of the box.

to show it in popup you could do a lot of stuff, you could ViewBag.Err = true;

check it in the view and render <script that will do the popup

Feb 26, 2011 at 4:42 PM

Hi,

Thanks for the input. Custom validation attribute will do. 

But then again i am using your MVC2 version . Not the MVC3.  I will have to work with viewdata.

 

 

Feb 27, 2011 at 7:41 AM

if u use attribute u don't need viewdata