Here Mudassar Ahmed Khan has explained the following three types of character length or count validations for ASP. Here Mudassar Ahmed Khan has explained with an example and attached sample code, how to filter Grid View records using Text Box in ASP. To accomplish the task I have made use of Sql Data Source with Filter Expression along with Filter Parameters to filter records and bind the ASP. The Text Box will be specified as Control Parameter in the Sql Data Source Filter Parameters, so that when text or value is entered in the Text Box and the Search Button is clicked, it will filter the Grid View Records based on Starts with LIKE Search.
Here Mudassar Ahmed Khan has explained, how to allow only Alphanumeric character values i.e.
The following HTML Markup consists of a Text Box, a Button and an HTML SPAN. For example:- - Minimum 8 characters at least 1 Alphabet and 1 Number - Minimum 8 characters at least 1 Alphabet, 1 Number and 1 Special Character - Minimum 8 characters at least 1 Uppercase Alphabet, 1 Lowercase Alphabet and 1 Number - Minimum 8 characters at least 1 Uppercase Alphabet, 1 Lowercase Alphabet, 1 Number and 1 Special Character - Minimum 8 and Maximum 10 characters at least 1 Uppercase Alphabet, 1 Lowercase Alphabet, 1 Number and 1 Special Character Here Mudassar Ahmed Khan has explained with an example and attached sample code, how to make use of Sql Data Source Filter Expression with Filter Parameters to filter records in ASP. In order to filter the Grid View records, I am making use of a Drop Down List control that will be used to select the filter records in Grid View.
To the Button a j Query click event handler is attached thus when the button is clicked, the Text Box text is validated against the Regular Expression (Regex) and if it contains character other than Alphabets or Space then an error message is displayed. Net Regular Expression Validator samples to validate Minimum and Maximum text Length and also different configurations like Alphanumeric with special characters, Alphanumeric, Alpha and Numeric configurations. The Drop Down List will be specified as Control Parameter in the Sql Data Source Filter Parameters, so that when a Value is selected in the Drop Down List it will filter the Grid View Records.
What would be the correct regular expression to use for this type of validation?
The previous section dealt primarily with validating strings; albeit, some of the strings were composed entirely of digits.
These were, however, still strings since the results of any mathimatical operation using them is meaningless. Numerical data is alway handled as string representations of numbers in (X)HTML forms or when the data is sent to the server.
This allows some string based tests to verify that the string's pattern matches acceptable numeric data. Said another way: only an unsigned (positive) whole number.
The following three different formats are demonstrated The first regular expression allows one or more characters in the set [0-9] preceded or followed by any number of spaces within the length of the string.