title: In asp.net how to validate textbox depending on other text box?
body: <p>In asp.net Depending on Experience I should validate the salary of an employee. </p>
  
  <p>If the employee is fresher his salary should be 1 lac to 1.5 lac. Or salary = 1.5 lac * years of exp to 3.5 * years of exp.</p>
  
  <p><em><strong></em>**</strong> i have tried his*<strong><em>*</em>**</strong>
      protected void Button1_Click(object sender, EventArgs e)
      {</p>
  
  <pre><code>    if (IntExp == 0)
      {
          RangeValidator1.MaximumValue = "150000";
          RangeValidator1.MinimumValue = "100000";
  
          RangeValidator1.Type = ValidationDataType.Integer;
          RangeValidator1.Validate();
          if (!RangeValidator1.IsValid)
          {
              RangeValidator1.ErrorMessage = "Enter CTC between 100000 and 150000";
          }
          Response.Redirect("ABCAddEmp.aspx");
  
      }
      else
      {
          int max = IntExp * 150000;
          int min = IntExp * 350000;
          RangeValidator1.MaximumValue = "max";
          RangeValidator1.MinimumValue = "min";
          RangeValidator1.Type = ValidationDataType.Integer;
          RangeValidator1.Validate();
  
          if (!RangeValidator1.IsValid)
          {
              RangeValidator1.ErrorMessage = "Enter CTC between " + max + " and " + min;
          }
          Response.Redirect("ABCAddEmp.aspx");
      }
  </code></pre>