Sunday, March 6, 2011

How to add Validator callout extender in Asp net

Hi Friends I would like to explain All the Ajax Toolkit Extenders from this first I am going to explain the validator callout extender
Before to use the validator callout extender why we have to use validator callout extender, the main purpose is it displays the validations in small popup which looks more beautiful for the UIso lets start the how to use validator callout extender. I already explained about how to integrate Ajax Toolkit to our Asp net application. if you have any doubt regarding integration just click here
So open your first ASP net application and open anyone one of your (.apsx) page.
Here you’re going to integrate validator callout extender.
Here, I would like to add validator callout extender to my registration page.
First, Open the source page of Registration page and these two lines otherwise your ajax will not work.

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

Next, open the design page of Registration form
Next, kept the Required Field Validator for Username textbox (see the below picture)

Now we are to going to add callout Extender for that Username validation
Just click on the red star symbol and click on the Add Extender

Next, select the Validation Callout Extender from the dialogue box and click ok button


Next finally, set the properties of validation..
Now code the will be look like this



<asp:TextBox ID="txt_uname" runat="server" Width="180px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ControlToValidate="txt_uname" ErrorMessage="UserName Compulsory">*</asp:RequiredFieldValidator>
                    <cc1:ValidatorCalloutExtender ID="RequiredFieldValidator1_ValidatorCalloutExtender" 
                        runat="server" Enabled="True" TargetControlID="RequiredFieldValidator1">
                    </cc1:ValidatorCalloutExtender>

And finally the output will be look like this when user forget to enter username in the regisration form

That’s it….Friends
developercode
About the Author
Sayyad is a Software Engineer, Blogger and Founder of Developers Code from India.His articles mainly focus on .Net (Web and Windows based applications), Mobile Technologies (Android,IPhone,BlackBerry) and SEO.

Labels: , , , , ,

2 Comments:

At March 13, 2011 at 6:37 PM , Blogger Dotnet Tutorials said...

good one...

 
At April 16, 2011 at 11:11 AM , Blogger Muhammad Azeem said...

This is a nice article..
Its easy to understand ..
And this article is using to learn something about it..

c#, dot.net, php tutorial, Ms sql server

Thanks a lot..!
ri70

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home