Featured On ...

asp.net

totalasp.co.uk

fuzzysoftware.com

devdex.com

123aspx.com

dotnetfreaks.com

411asp.net

and more ...

ValidatorEntryClientServer

Full path

MadWidgets.Validation.ValidatorEntryClientServer

Declaration

public class ValidatorEntryClientServer : ValidatorEntry

Hierarchy

Click on the selected class to view any properties or methods that may be accessible through an instance of this class through inheritance.

ValidatorEntryClientServer

Overview

The ValidatorEntryClientServer class is the base class for all validation entries that may be validated on both the client and the server.

Constructors

Public properties

Protected internal methods

Protected methods


Constructors

ValidatorEntryClientServer

public ValidatorEntryClientServer(string sMessage, string sHighlightElement, bool bNegate)

Creates a ValidatorEntryClientServer with a message, a client-side highlight element signature and a negate value.

Public properties

HighlightElement

public virtual string HighlightElement {get;}

Returns the client-side highlight element signature supplied in the contructor.

The highlight element signature can be one of two things: a client-side element identifier (not a field name) or a pattern identifying an element in the parent tree of the first validated field.

The pattern takes the following form:

<tagName[elementProperty=propertyValue]> or <tagName>

Where tagName is the name of an HTML tag, elementProperty is the name of a property that can be found on the element identified by tagName and propertyValue is the string value of that property. Note that the property value in the pattern must not be surrounded with quotes.

Using the first element in the validation entry (e.g. the first object added to the ValidatorEntryMultiple instance), the client-side validation code navigates up the parent hierarchy until it finds an element whose property matches that of the pattern. This process is done once during the loading of the page and before any CSS classes are swapped. The element that is found during this process is marked as the highlight element. During validation failure and success, the HighlightClass and original class found on the element are swapped respectively.

If the pattern does not contain the elementProperty=propertyValue section, a match of the first element whose type matches tagName will occur.

If no match occurs, no error occurs. The validation code will simply not use a highlight element for that validation entry.

Protected internal methods

GroupElementInitializationCode

protected internal abstract string GroupElementInitializationCode(int iId)

This abstract method is used internally and is of interest only to those who would like to make fairly complex extension of the ValidatorEntryClientServer class. You should never need to override this method, however, if you would like to know more about it, please contact me.

ClientSideInitializationCode

protected internal string ClientSideInitializationCode()

Like GroupElementInitializationCode, this abstract method is used internally and is of interest only to those who would like to make fairly complex extension of the ValidatorEntryClientServer class. You should never need to override this method, however, if you would like to know more about it, please contact me.

ClientSideCode

protected internal abstract string ClientSideCode()

This abstract method is called by the Validator control when it needs to write client-side code to the page. Client-side Javascript code returned from this method is written only once to the output stream. If you override this method, you should use it to write Javascript functions that are relevant to the validation call that is made in the ClientSideValidateCode() method. In general you should always concatenate the value returned by the base class's ClientSideCode with any additional client-side functionality that you are adding.

Protected methods

ClientSideValidateCode

protected abstract string ClientSideValidateCode()

This abstract method is called by various subclasses of the ValidatorEntryClientServer class when the Validator control requests ClientSideInitializationCode() from each of the ValidatorEntry objects it holds. The return value from this method should be a client-side Javascript expression resulting in a boolean value that when true indicates that the value of the object being tested is valid. You should not include the Javascript keyword return in the code though.

For example, assuming you had a function called validateMyFieldType(value) { . . . } that you defined and returned from ClientSideCode(), if this function was the only function that was required to determine the validity of the value, then the return value of ClientSideValidateCode() would be a call to that function, specifically "validateMyFieldType(value)".

Note that the client-side variable value is available to all subclasses of the ValidatorEntryClientServer class except for subclasses of the ValidatorEntryComparer class, which uses the Javascript variables value1 and value2 for its first and second object respectively.

© 2002 - 2009 Copyright, Disclaimer and Privacy Statement