Validate at Least One TextBox in ASP.NET

  1. <asp:TextBox ID="txtHomePhone" runat="server"></asp:TextBox>  
  2. <asp:CustomValidator ID="cvHomePhone" runat="server" ErrorMessage="*" ClientValidationFunction="Validate" ControlToValidate="txtHomePhone"  ValidateEmptyText="true"></asp:CustomValidator>  
  3.   
  4.   
  5. <asp:TextBox ID="txtWorkPhone" runat="server"></asp:TextBox>  
  6. <asp:CustomValidator ID="cvWorkPhone" runat="server" ErrorMessage="*" ClientValidationFunction="Validate" ControlToValidate="txtWorkPhone"  ValidateEmptyText="true"></asp:CustomValidator>  
  7.   
  8.   
  9. <asp:TextBox ID="txtMobilePhone" runat="server"></asp:TextBox>  
  10. <asp:CustomValidator ID="cvMobilePhone" runat="server" ErrorMessage="*" ClientValidationFunction="Validate" ControlToValidate="txtMobilePhone"  ValidateEmptyText="true"></asp:CustomValidator>  
  11.   
  12.   
  13. <script language="javascript">  
  14. function Validate(sender, args)  
  15. {  
  16.     args.IsValid = false;  
  17.     if(args.Value != "")  
  18.     {  
  19.         args.IsValid = true;  
  20.     }  
  21. }  
  22. </script>