In asp.net Depending on Experience I should validate the salary of an employee.
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.
** i have tried his**** protected void Button1_Click(object sender, EventArgs e) {
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");
}