Monday, March 26, 2012

Validating detailsview dataentry

Hi

Any help help me out with a way of validating a field entry on a detailsview control. The field is strictly supposed to recieve only one of these three strings ( Employee, Dependent or Others). Iam strugling to guarantee that only and only one of the above three is entered in this column but with no success so far and i dont want to assume that the data entry personel will do this for me, i simply can not rely on them. I tried using a dropdownlist but that didn't insert the selected value into the database column. Will any one direct me to a usefull link.

Nick.

Hey,

I would consider using the dropdownlist; you can get it to work by doing this: http://dotnetslackers.com/community/blogs/bmains/archive/2006/08/16/352.aspx

Otherwise, you can validate using the same approach; you can access the Values collection for Inserting and NewValues for updating, ensuring that the field is a specific value. If not, then you can cancel the insertion, and post an error message to the user.


I have tried that but northing happens in the underlying table column. I only get the message that the field can not be left NuLL. If you dont mind, Please clarify for me.


Hey,

Actually, I could help you out better if I saw the code you tried to implement and the HTML for the DetailsView...


Thanks for the tip bmains, i got my dropdownlist working.

No comments:

Post a Comment