Torna al Thread
<script language="javascript">
function testCognome(arg1, arg2)
{
var RegExp = /^[a-zA-Z0-9 èéòàù']{2,25}$/;
arg2.IsValid = RegExp.test(arg2.Value);
}
</script>
<asp:TextBox ID="txtRicercaImpresa_Cognome" runat="server" CssClass="testonero" AutoCompleteType="none" BorderStyle="Solid" Width="350"></asp:TextBox>
<asp:CustomValidator ID="cvdRicercaImpresa_Cognome" runat="server" ClientValidationFunction="testCognome" ControlToValidate="txtRicercaImpresa_Cognome" CssClass="errorCustomValidator" ErrorMessage="Campo obbligatorio" Display="Dynamic" EnableClientScript="True" ValidateEmptyText="False" SetFocusOnError="True" onServerValidate="cvdRicercaImpresa_Cognome_ServerValidate"></asp:CustomValidator>
protected void cvdRicercaImpresa_Denominazione_ServerValidate(object source, ServerValidateEventArgs args)
{
if (args.Value.Trim().Length >= 2 && args.Value.Trim().Length <= 50)
args.IsValid = true;
else
args.IsValid = false;
}