Click here to Skip to main content
Click here to Skip to main content
Articles » Web Development » ASP.NET » General » Downloads
Add your own
alternative version

Exploring ASP.NET Validators

, 9 Apr 2010 CPOL
This article digs deep into ASP.NET validators and discusses a few case studies which may be a boon for any project
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="popup.aspx.cs" Inherits="popup" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControlToolkit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
<script language="javascript" type="text/javascript">
//This function is used read the query string
function querySt(ji) {
    hu =;
    gy = hu.split("&");
        for (i=0;i<gy.length;i++) 
            ft = gy[i].split("=");
            if (ft[0] == ji) 
                return ft[1];
//This function is used to save the value in grid
function SaveValue(textboxid)
    if(Page_ClientValidate('popup') !=false)
    return false;
function validatetextbox(sender, args)
            sender.errormessage="<b>Invalid field</b><br />Only Numbers are alowed." ;        
            args.IsValid = false; 

    <title>Untitled Page</title>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Text="save" OnClientClick="javascript:return SaveValue('TextBox1')"/>
        <asp:CustomValidator ID="gridValidator" runat="server" ClientValidationFunction="validatetextbox" ControlToValidate="TextBox1" ValidationGroup="popup"></asp:CustomValidator>
        <AjaxControlToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" TargetControlID="gridValidator" PopupPosition="BottomLeft">

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior)
India India
Brij is a 3-times Microsoft MVP in ASP.NET/IIS Category and a passionate .NET developer. More than 6 years of experience in IT field, currently serving a MNC as a Tech Lead/Architect.
He is a very passionate .NET developer and have expertise over Web technologies like ASP.NET 2.0/3.5/4.0, jQuery, JSON, Javascript, IIS and related technologies. He is also a Exchange Server (EWS) Specialist. He has great experience in design patterns and N-Tier Architecture.
He is also certified as Microsoft Certified Technologies Specialist-ASP.NET and Microsoft Certified Technologies Specialist-WCF in .NET 4.0. He has also received several awards at various forums and his various articles got listed as "Article of the day" at ASP.NET Microsoft Official Website
He has done MCA from NIT Durgapur and completed his graduation from Lucknow University.
Learning new technologies and sharing knowledge excites him most. Blogging, solving problems at various forums, helping people, keeps him busy entire day.

Visit his Blog: Code Wala
Area of Expertise :
C#, ASP.NET 2.0,3.5,4.0, AJAX, JQuery, JSON, XML, XSLT, ADO.Net, WCF, Active Directory, Exchange Server 2007 (EWS), Java script, Web Services ,Win services, DotnetNuke, WSS 3.0,Sharepoint Designer, SQL Server 2000/2005/2008
Follow on   Twitter   LinkedIn

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150327.1 | Last Updated 10 Apr 2010
Article Copyright 2010 by Brij
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid