Validator Issues

Is it possible to validate an entry using a validator if the inputted account number exists on the database?

No, I do not. Just google Extending custom validation control. it does not even have to be that, you can just build a custom solution for that that just calls a function or something

No, you will need to write your own custom validation control

Do you have a site, that teaches on how to create a custom validation control?

Here is a simple example on validation.

Custom Data Validation to find out if the text is longer then 8 characters:


protected void TextValidate(object source, ServerValidateEventArgs args)
{
   args.IsValid = (args.Value.Length >= 8);
}


Here is the Custom Validater control on the .aspx page to validate the TextBox1 control…


asp:textbox id=TextBox1 runat="server"></asp:textbox>
<asp:CustomValidator id="CustomValidator1" runat="server" 
   OnServerValidate="TextValidate" 
   ControlToValidate="TextBox1" 
   ErrorMessage="Text must be 8 or more characters.">
</asp:CustomValidator>


If, you want the best of both-worlds, you can also validate on the client-side…


<SCRIPT LANGUAGE="JavaScript">
function validateLength(oSrc, args){
   args.IsValid = (args.Value.length >= 8);
}
</SCRIPT>
      
<asp:Textbox id="text1" runat="server" text="">
</asp:Textbox>
      
<asp:CustomValidator id="CustomValidator1" runat=server 
      ControlToValidate = "text1"
      ErrorMessage = "You must enter at least 8 characters!"
   ClientValidationFunction="validateLength" >
</asp:CustomValidator>