customvalidator

Custom validator dynamic ServerValidate using Reflection

I have a UserControl which contains a TextBox and a CustomValidator. I would like to set the CustomValidator.ServerValidate to a method in the page that contains the UserControl I found this code which will allow me to dynamically set the custom validators validation function: cusvCustom.ServerValidate += new System.Web.UI.WebControls...

How to add Custom logic for validation using asp.net mvc data annotations?

I have read this before about asp.net mvc validations but does not mention what i want to do,So have this view model - public class MyViewModel { [StringLength(200, MinimumLength = 2, ErrorMessage = "Invalid Name")] public string Name { get; set; } [Required(ErrorMessage = "*")] public DateTime StartDate...

Combine Webmethod and CustomValidator

I want to use ajax with validator control. for example, the various error messages should be show when a user input his/her name in a textbox to register: if nothing is input, "you should input your name"; if not correct format, "your username is not valid formatted"; if the username has used by other user, "the usename has been used ...

Prevent same value chosen in several dropdown lists

Hi, I have four dropdown lists with same items/values. I want to prevent the same value is chosen more than once when the form is uploaded. How can I do that using a custom validator? Thanks! ...

Javascript + Asp: FileUpload and CustomValidator

Hi, How can I create a CustomValidator on Client Side for validating my file path from FileUpload? Thanks ...

Asp.Net custom validator: how to get the 'controlToValidate' property on ClientValidationFunction?

Hi everybody Lets say I have this code. <asp:TextBox ID="TextBox1" runat="server" /> <asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ValidationFunction1" ControlToValidate="TextBox1" Display="Dynamic" /> And a validationFunction: function ValidationFunction1(sender, args) { } And i ...

custom validator client side function

Hi, I have a custom validator (.net 3.5) that checks if four dropdown lists in my form have repeated values. It works on the server-side but I would like to add a client-side function to go with it. I have no knowledge of JavaScript. Could you help? Mant thanks. <asp:CustomValidator id="CustomValidator1" runat="server" ErrorMessage = "...

Ajax ValidatorCalloutExtender can it work with Customvalidator

Hi , Can anyone tell me whether i can use ValidatorCalloutExtender with Customvalidator which has server side validation? An example would be great. thanks, Niall ...

ASP.NET Custom Validator + WebMethod + jQuery

Hi guys, I'm trying to implement a .NET Custom Validator that uses $.ajax to query a WebMethod on the same page and return a boolean value to indicate whether the result is true or false. The WebMethod I'm using is really simple [WebMethod()] public static bool IsPromoValid(string code) { string promoCode = "ABCDEFG"; bool res...

ASP CustomValidator, advancing to postback after error

Hello, I have an ASP .NET page with ASP validators (Required Field, Regular Expression,...) plus java script functions for additional validation (for example, to check if second date bigger than first date, among others). I usually do: <script type="text/javascript"> function validate() { // ... alert('Not valid!'...