In asp.net how to validate textbox depending on other text box?

Sacrolash

New Member
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) {\[code\] if (IntExp == 0) { RangeValidator1.MaximumValue = "http://stackoverflow.com/questions/12767704/150000"; RangeValidator1.MinimumValue = "http://stackoverflow.com/questions/12767704/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 = "http://stackoverflow.com/questions/12767704/max"; RangeValidator1.MinimumValue = "http://stackoverflow.com/questions/12767704/min"; RangeValidator1.Type = ValidationDataType.Integer; RangeValidator1.Validate(); if (!RangeValidator1.IsValid) { RangeValidator1.ErrorMessage = "Enter CTC between " + max + " and " + min; } Response.Redirect("ABCAddEmp.aspx"); }\[/code\]
 
Back
Top