Required Field Validation on a dropdown

Required Field Validation on a dropdown

Old forum URL:

bdr posted on Wednesday, April 28, 2010

I would like to know if there is a way to use the built in validation rules to check to see if the user has selected a value in a dropdown.  I tried the IntegerMinValue and that did work, however the message that we are hoping for would be "Status is Required" not "Status must have a value greater than 0".  I also tried the StringRequired, but since the value of the dropdown is an integer, it didn't seem to work either. 

I apologize ahead of time if this has been covered on this forum.  I couldn't seem to find it. 

Thank you.


Marjon1 replied on Thursday, April 29, 2010

There is nothing within the standard common rules, but it is quite easy to create your own common rule that can display a message that you want. In our project, we've actually created a rule to determine that a value is required, be this string or foreign key (integer) and it reports similar to what you wanted. 

Depending on what version of CSLA you are using, this can be done as an attribute (e.g. DataAnnotations) or via a standard CSLA custom rule.

If you need any more assistance, please feel free to ask and I can post some code samples.

Copyright (c) Marimer LLC