Format and Validate Fields

This sample demonstrates how the FormatField event can be used to change the way fields are displayed in the grid and in the edit controls. It also demonstrates how a field (BirthDate) can be validated using a custom validation check and how custom error messages can be displayed using the Error event.

In the grid below, the Notes field is formatted so that only the first 10 words are displayed, and a tooltip appears when the user hovers the mouse over the field. This is implemented by generating a <span>-tag with an appropriate title attribute in the FormatField event handler (see the source code).

In edit mode, the Birthday field is formatted differently from the default formatting that is specified in the XML configuration file. In edit mode, the day of the week is removed, so that the value entered by the user is parseable.

Employees

Search:  

 IDLastNameFirstNameBirthDateNotes
Edit5BuchananStevenFri 04 Mar 1955 Steven Buchanan graduated from St. Andrews University, Scotland, with a ...more (see tooltip)
Edit8CallahanLauraThu 09 Jan 1958 Laura received a BA in psychology from the University of ...more (see tooltip)
Edit1DavolioNancyWed 08 Dec 1948 Education includes a BA in psychology from Colorado State University ...more (see tooltip)
Edit9DodsworthAnneThu 27 Jan 1966 Anne has a BA degree in English from St. Lawrence ...more (see tooltip)
Edit2FullerAndrewTue 19 Feb 1952 Andrew received his BTS commercial in 1974 and a Ph.D. ...more (see tooltip)
Page: 1 2 Next