c# mvc how to validate 3rd column Value Based on Two column

66 views Asked by At

Here I have three properties Like

Public Class Addition{
public Int Val1{get;se;}
public Int Val2{get;se;}
public Int Val3{get;se;}
}

In .cshtml Val1=10;Val2=20; If User Entre Val3=30 Then How can i validate Val3 Value Should Be LessThan or Equal to 30 Beacause (10+20=30)

1

There are 1 answers

0
Shyam On

What is the problem are you facing to solve it. it shouldn't be complex You can use

if(Val3 > (Val1 + Val2))                                                             
{             
  //Show Your Message
  return;
}

Upvote if helps