Step 1 : First you require Ajaxtoolkit to be added to your asp.net toolbox.
Step 2:
Add the RequiredFieldValidator control from toolbox for textbox control to validate.
Step 3:
Add the ToolkitScriptManager control from the toolbox just below the form tag.
Step 4:
Use the ValidatorCalloutExtender control from the ajax toolkit tools which you have got after adding ajaxtoolkit.dll to the toolbox.
The code must look like this :
<asp:ToolkitScriptManager
ID="ToolkitScriptManager1"
runat="server">
</asp:ToolkitScriptManager>
<span>
First Name</span>
<asp:TextBox
ID="txtFirstName"
runat="server"
></asp:TextBox>
<asp:RequiredFieldValidator
ID="rqdFirst"
runat="server"
ControlToValidate="txtFirstName"
ErrorMessage="Enter
First name!"
Display="None"></asp:RequiredFieldValidator>
<asp:ValidatorCalloutExtender
ID="ValidatorCalloutExtender1"
runat="server"
TargetControlID="rqdFirst">
</asp:ValidatorCalloutExtender>
The output window will look like this :
No comments:
Post a Comment