Validating gridview

This will convert them from Bound Field to Template Field.

Now from the smart tag of the Grid View choose "Edit Template" and then select "Edit Item Template" of Company Name column.

Learn more about Data Annotation attribute usage in ASP.

NET MVC validation in the following blog post: How data annotations for ASP. The code sample below demonstrates how to add the Data Annotation attributes to the model class properties.

You can learn more about unobtrusive client validation from the following blog post: Unobtrusive Client Validation in ASP. To define validation rules for user input, add the required Data Annotation attributes to the corresponding model class properties.

NET MVC data editors support a model-based data validation approach implemented in the ASP. This approach is based on decorating model class properties with the Data Annotations attributes and j Query Validation.

Here, we set the Data Source of the Grid View to Sql Data Source1. We also enable paging, sorting and editing features of the Grid View.The grid control has built-in data type validation enabled by default.If you enter a string value into a column bound to a numeric data field, and then, press ENTER or try to move focus away from the cell, the grid validates data input and raises an error as the string cannot be converted to a numeric value.We need to convert these Bound Fields to Template Fields.In order to do so select "Edit Columns..." from the smart tag of the Grid View. Select Company Name and Contact Name fields and click on "Covert this field into a Template Field" link.

Leave a Reply