V
VSK
Hi all,
I have a .ascx file with
dropdownbox (SSN, EmpName)
textbox
submit button
regular expression validator( controltovalidate is the above textbox)
Now i want to change the Regular Expression of the validator based on the
dropdownlist item selected.
So i have written the following code in .ascx.cs file
private void ValidateSearchText()
{
if(drpSearchField.SelectedItem.Text == "EmpName")
{
genericRegExpression.ValidationExpression = @"^[A-Za-z\-]+$";
genericRegExpression.ErrorMessage="Please enter only characters for
LastName" ;
}else{
...........................
}
}
This method will be called when the button is clicked.
The problem is that the validator is emitting error mesaage as expected.
Has anyone tried this. Please suggest on this.
Thanks
VSK
I have a .ascx file with
dropdownbox (SSN, EmpName)
textbox
submit button
regular expression validator( controltovalidate is the above textbox)
Now i want to change the Regular Expression of the validator based on the
dropdownlist item selected.
So i have written the following code in .ascx.cs file
private void ValidateSearchText()
{
if(drpSearchField.SelectedItem.Text == "EmpName")
{
genericRegExpression.ValidationExpression = @"^[A-Za-z\-]+$";
genericRegExpression.ErrorMessage="Please enter only characters for
LastName" ;
}else{
...........................
}
}
This method will be called when the button is clicked.
The problem is that the validator is emitting error mesaage as expected.
Has anyone tried this. Please suggest on this.
Thanks
VSK