Ajax ValidatorCalloutExtender in asp3.5

In this blog you will learn that how to validate an control with popup using ajax:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="validatoreg.aspx.cs" Inherits="validatoreg" %>
importing ajaxcontrol toolkit

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
   Name: <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" TargetControlID="RequiredFieldValidator1"    runat="server">
    </asp:ValidatorCalloutExtender>
    <asp:RequiredFieldValidator  Display="None" ID="RequiredFieldValidator1" runat="server"  ControlToValidate="TextBox1" ErrorMessage="User Name cannt be left blank"></asp:RequiredFieldValidator>
   Email:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>  
    <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" TargetControlID="RequiredFieldValidator2"  runat="server">
    </asp:ValidatorCalloutExtender>
  <asp:RequiredFieldValidator ID="RequiredFieldValidator2"  Display="None" runat="server"  ControlToValidate="TextBox2" ErrorMessage="Email cannt be left blank"></asp:RequiredFieldValidator>
   <asp:Button ID="b" runat="server" Text="Login" />
    </form>
</body>
</html>

Thanks
Ebook Download
View all
Learn
View all