lundi 30 mai 2016

How to display error message under right element in the UI

I have these two view model properties that has these validation attributes.

[CardTypeValidation(ErrorMessage = "Card type is mandatory")]
public CCardType CardType { get; set; }

[CardNumberValidation("CardType", ErrorMessage = "Card type is not a right match for the card number provided")]
public string CardNumber { get; set; }

Now my problem is all validation works fine but the error message "Card type is not a right match for the card number provided" is displayed underneath the Card number textbox. (Which is right below the Card Type dropdown).

My tester is after that the message should be displayed under the Card Type dropdown.

If I put this attribute on the Card Type, then it has some wierd exception and not proper validation either. So its just the message instead of getting displayed under the card number, it should display under the card type. How to do that?

Aucun commentaire:

Enregistrer un commentaire