As promised weeks ago, here is my ASP.NET AJAX validation control “framework”.
To create your own AJAX validation control:
1. Create a new class which inherits UPDN.AjaxValidator:
1.public class YourValidator : UPDN.AjaxValidator { /*...*/ }
2. Provide a public static method to perform the validation, the signature of the method should be:
1.public static ValidationResult YourValidationMethod(string value)
3. Override OnServerValidate to call your public static validation method:
1.protected override bool OnServerValidate(string value)
2.{
3. var result = YourValidationMethod(value);
4. return result.IsValid;
5.}
4. Override GetScriptReferences to include your client-side script:
1.protected override void GetScriptReferences(ScriptReferenceCollection references)
2.{
3. base.GetScriptReferences(references);
4. references.Add(new ScriptReference("~/Scripts/YourValidator.js"));
5.}
5. Create the client-side control for your validation control, which inherits UPDN.AjaxValidator:
01.Type.registerNamespace("Example");
02.Example.YourValidator = function(element) {
03. Example.YourValidator.initializeBase(this, [element]);
04.};
05.Example.YourValidator.prototype = {
06. // Override validate to do pre-validation checks.
07. validate: function(val, args, event) {
08. Example.YourValidator.callBaseMethod(this, "validate", [val, args, event]);
09. },
10. // Override validated to do post-validation stuff.
11. validated: function(result, event) {
12. var val = this.get_element();
13. // Do your custom validation message display stuff here!
14. }
15.};
16.Example.YourValidator.registerClass("Example.YourValidator", UPDN.AjaxValidator);
6. Expose the YourValidationMethod method in YourValidator class as a “Page Method” in the code-behind:
1.[WebMethod]
2.public static ValidationResult YourValidationPageMethod(string domain)
3.{
4. return YourValidator.YourValidationMethod(domain);
5.}
7. Add reference to your validation control in Web.config:
view source
print?
1.<pages>
2. <controls>
3. ...
4. <add tagPrefix="example" namespace="Example"/>
5. </controls>
6.</pages>
8. Add the validation control to your page, set the PageMethodName property to “YourValidationPageMethod”:
1.<example:YourValidator runat="server" ID="YourValidator1" ControlToValidate="TextBox1" Display="Dynamic" ErrorMessage="Your error message" PageMethodName="YourValidationMethod" ProgressIndicatorCssClass="wait" />
Download the (VS.NET 2008) solution from my SkyDrive.
Related Stuff
-
MooV: Using cutting edge Video phones and Software Video Phones - coupling all that with VoIP and empowering the disabled.
-
Moo Telecom: VoIP communications made easy - Ring anyway with the fun and ease of using a normal phone
-
TagR:Mobile Social Network with Real Time Locations Based services, and Ambience Intelligence, VoiP, IM, Skype, Googletalk, Mapping, Flickr, Events, Calendaring, Scheduling, SecondLife Support
-
ClearSMS : ClearSMS is a Web-based application that lets you send bulk SMS messages to your customers, contacts, or just about anyone.
-
Jajah:jah is a VoIP (Voice over IP) provider, founded by Austrians Roman Scharf and Daniel Mattes in 2005[1]. The Jajah headquarters are located in Mountain View, CA, USA, and Luxembourg. Jajah maintains a development centre in Israel.
-
Skype: It’s free to download and free to call other people on Skype. Skype the number one voice over ip software
- PrivatePhone: a free local phone number with voicemail and messages you can check online or from any phone.

Original Source: