Hello I'm using MVC Fool Proof Validation. to validate my model, and i need to use RequiredIfNotEmpty
with two fields but i'm getting issues with it
Model
public class Conexionado{
[DisplayName("Conexión")]
[RequiredIfNotEmpty("Conex_BT2_Pos", ErrorMessage = "Error!")]
[RequiredIfNotEmpty("Conex_BT2_N", ErrorMessage = "Conex_BT2 Cant be empty if Conex_BT2_N isnt!")]
public string Conex_BT2 { get; set; }
public string Conex_BT2_N { get; set; }
[DisplayName("Ángulo BT")]
[Range(0, 11, ErrorMessage = "Incorrect number")]
public int? Conex_BT2_Pos { get; set; }
}
I have tried some like
[RequiredIfNotEmpty("Conex_BT2_Pos , Conex_BT2_N", ErrorMessage = "Error!")]
[RequiredIfNotEmpty("Conex_BT2_Pos || Conex_BT2_N", ErrorMessage = "Error!")]
But in this case, i can compile, but when i try to use Conex_BT2
i get
'System.NullReferenceException' en FoolproofValidation.dll
Someone know how i must deal with it?
Thanks!