s of those validation controls that detected invalid data.This summary data can be displayed as text on the web page or through a modal, client-side messagebox.While this exception can be gracefully handled as demonstrated in the previous tutorial, ideally the editing or inserting user interface would include validation controls to prevent a user from entering such invalid data in the first place.In order to provide a customized editing or inserting interface, we need to replace the Bound Field or Check Box Field with a Template Field.The Compare Validator's Figure 8: An Asterisk Appears Next to the Textboxes with Invalid Input (Click to view full-size image) While the validation works as-is, the user has to manually remove the currency symbol when editing a record, which is not acceptable.To remedy this, we have three options: Statement (Click to view full-size image) With this change, the formatted price in the editing interface includes commas as the group separator and a period as the decimal separator, but leaves off the currency symbol.Template Fields, which were the topic of discussion in the Using Template Fields in the Grid View Control and Using Template Fields in the Details View Control tutorials, can consist of multiple templates defining separate interfaces for different row states.
You can verify this by visiting this page through a browser.The Grid View and Details View controls in the examples we've explored over the past three tutorials have all been composed of Bound Fields and Check Box Fields (the field types automatically added by Visual Studio when binding a Grid View or Details View to a data source control through the smart tag).When editing a row in a Grid View or Details View, those Bound Fields that are not read-only are converted into textboxes, from which the end user can modify the existing data.To help ensure that a user's inputs are valid, ASP.
NET provides five built-in validation controls that are designed to be used to validate the value of a single input control: For more information on these five controls, check out the Validation Controls section of the ASP. For our tutorial we'll need to use a Required Field Validator in both the Details View and Grid View's Note While ASP.
Additionally, the page included a Details View whose , thereby always rendering in insert mode.