AUC Technologies Projects Consulting, Development, Mentoring, and Training Company ASP.NET Validation Control Presented By : Muhammad Atif Hussain Deputy.

Slides:



Advertisements
Similar presentations
Tutorial 6 Creating a Web Form
Advertisements

Ch3: Introduction to HTML5 part 2 Dr. Abdullah Almutairi ISC 340 Fall 2014.
CHAPTER 30 THE HTML 5 FORMS PROCESSING. LEARNING OBJECTIVES What the three form elements are How to use the HTML 5 tag to specify a list of words’ form.
Asp.NET Core Vaidation Controls. Slide 2 ASP.NET Validation Controls (Introduction) The ASP.NET validation controls can be used to validate data on the.
web controls  standard controls  validation controls  rich controls.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 3-1 of…
Tutorial 14 Working with Forms and Regular Expressions.
ASP.NET Validating user input Validating user input on the client and/or server side 1ASP.NET Validating User Input.
ASP.NET Programming with C# and SQL Server First Edition
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
Lesson 8 Creating Forms with JavaScript
Chapter 9 – Validating User Input Dr. Stephanos Mavromoustakos.
XP Tutorial 14 New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with Forms and Regular Expressions Validating a Web Form with JavaScript.
JavaScript Form Validation
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Building the User Interface by Using HTML5: Organization, Input, and Validation Lesson 3.
Regular Expressions Week 07 TCNJ Web 2 Jean Chu. Regular Expressions Regular Expressions are a powerful way to validate and format text strings that may.
CIS 375—Web App Dev II ASP.NET 2 Introducing Web Forms.
JavaScript Teppo Räisänen LIIKE/OAMK HTML, CSS, JavaScript HTML defines the structure CSS defines the layout JavaScript is used for scripting It.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Module 7: Validating User Input.
.NET Validation Controls MacDonald Ch. 8 MIS 324 MIS 324 Professor Sandvig Professor Sandvig.
Chapter 3 Using Validation Controls. What is a Validation Control? A control that validates the value in another control Renders as an HTML tag with an.
Server vs Client-side validation. JavaScript JavaScript is an object-based language. JavaScript is based on manipulating objects by modifying an object’s.
Tutorial 14 Working with Forms and Regular Expressions.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
1 Web-Enabled Decision Support Systems Introduction to ASP.NET Prof. Name Position (123) University Name.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
Validation Controls. Validation Server Controls These are a special type of Web server control. They significantly reduce some of the work involved in.
Telerik Software Academy ASP.NET Web Forms Data Validation, Data Validators, Validation Groups Telerik Software Academy
Overview of Previous Lesson(s) Over View  Server controls are small building blocks of the graphical user interface, which includes  Text boxes  Buttons.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
1 ASP.NET ASP.NET Rina Zviel-Girshin Lecture 3. 2 Overview Cookies Validation controls Client and server side validation Validation control examples.
Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Digital Media.
JavaScript is a client-side scripting language. Programs run in the web browser on the client's computer. (PHP, in contrast, is a server-side scripting.
ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
JavaScript: Functions © by Pearson Education, Inc. All Rights Reserved.
Validation and Rich controls 1www.tech.findforinfo.com.
Microsoft Visual Basic 2008 CHAPTER SEVEN Creating Web Applications.
C# Tutorial -1 ASP.NET Web Application with Visual Studio 2005.
Microsoft Visual Basic 2005 CHAPTER 7 Creating Web Applications.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
Web User Controls This presentation will cover the basics of defining, creating and using a web user control. Presented to Twin Cities.NET user group By.
Lesson 12 Adding Validation To The Movie Database.
Working with Forms and Regular Expressions Validating a Web Form with JavaScript.
VALIDATION CONTROLS.  Validation Controls are primarily used to validate, or verify the data entered by user into a web form.  Validation controls attempt.
HTML Forms. Slide 2 Forms (Introduction) The purpose of input forms Organizing forms with a and Using different element types to get user input A brief.
HTML JAVASCRIPT. CONTENTS Javascript Example NOSCRIPT Tag Advantages Summary Exercise.
Session 6: Validating User Input. Outline Overview of User Input Validation Client-Side and Server-Side Validation ASP.NET Validation Controls Using Validation.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 User Input Validating.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
 Previous lessons have focused on client-side scripts  Programs embedded in the page’s HTML code  Can also execute scripts on the server  Server-side.
Vijayalakshmi G M Validation Controls.
XP Tutorial 7 New Perspectives on JavaScript, Comprehensive 1 Working with Forms and Regular Expressions Validating a Web Form with JavaScript.
Text INTRODUCTION TO ASP.NET. InterComm Campaign Guidelines CONFIDENTIAL Simply Server side language Simplified page development model Modular, well-factored,
Beginning ASP.NET in C# and VB Chapter 9
Tutorial 6 Creating a Web Form
Ashima Wadhwa Java Script And Forms. Introduction Forms: –One of the most common Web page elements used with JavaScript –Typical forms you may encounter.
Validation Controls Assist your users with providing the correct type of input for your application Assist your users with providing the correct type of.
Web Application Web Application are programs that can be executed either on a Web server or in a Web browser. An Online store accessed through a browser.
Web Programming– UFCFB Lecture 17
Working with Forms and Regular Expressions
Unit 27 - Web Server Scripting
12/9/2018 Session 9.1 Calendar and Validation Controls Using Sessions
JavaScript Form Validation
PART 2.
Web Development Using ASP .NET
MIS 3200 – Unit 2.2 Outline What’s the problem with bad data?
.NET Validation Controls
Presentation transcript:

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company ASP.NET Validation Control Presented By : Muhammad Atif Hussain Deputy Manager IT (Takaful Pakistan Limited) Technologies Consultant (AUC Technologies) MCS(KU) MSCS(SZABIST) MCP MCAD MCSD MCTS (Windows, Web, Distributed Applications) MCPD (Enterprise Applications) MCT(Microsoft Certified Trainer)

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Recall Validating data Display error messages Client Side Scripting Inline JavaScripting JS Validation Control Create custom validation criteria Agenda

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Controls Layout style for Web form Server controls vs. HTML controls Bind control values to data items Write code to respond to user events on controls. Recall

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company User gives in an input. Mostly this will be wrong. You will have to perform validation and inform user about his wrong data. There can be two kind of validation. –Server Side. –Client Side. Validating User Input

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company This is actually performed by your Code. This validation is normally called when an event occurs. This actually increases the load on the server. The responses are slow. Server Side Validation

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company These checks can be done when the client is inputting the data. This makes your application more interactive and faster. It also reduces the load on the server. Client Side Validation

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Normally JavaScript is used for doing the Client side validation. But in ASP.NET there is no requirement of knowing JavaScript to do client side validation. Traditional way of doing it

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company The validation controls check the validity of data entered in associated server controls It is done before the page is posted back to the server. Most validity problems can be caught and corrected by the user without a round trip to the server Using Validation

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company  RequiredFieldValidator  CompareValidator  RangeValidator  RegularExpressionValidator  CustomValidator  ValidationSummary Validation Controls

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company ControlToValidate  This property lets the validator know which control it has to validate. (It binds the validator to that control and then the validator monitors that control.) ErrorMessage  This is the error message that appears in the validation summary when the control being validated violates the condition set by the validator. Text  Information that gives guidance to correct the error. Validation Controls

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Validation controlUse to RequiredFieldValidatorCheck whether a control contains data CompareValidator Check whether an entered item matches an entry in another control or particular value. RangeValidatorCheck whether an entered item is between two values. RegularExpressionValidator Check whether an entered item matches a specified format CustomValidator Check the validity of an entered item using a client-side script or a server-side code, or both ValidationSummary Display validation errors in a central location or display a general validation error description ASP.NET Validation Controls

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Draw a validation control on a Web form and set its ControlToValidate property to the control you want to validate. If you’re using the CompareValidator control, you also need to specify the ControlToCompare property. Set the validation control’s ErrorMessage property to the error message you want displayed if the control’s data is not valid. Set the validation control’s Text property if you want the validation control to display a message other than the message in the ErrorMessage property when an error occurs. Setting the Text property lets you briefly indicate where the error occurred on the form and display the longer ErrorMessage property in a ValidationSummary control. Draw a ValidationSummary control on the Web form to display the error messages from the validation controls in one place. Provide a control that triggers a postback event. Although validation occurs on the client side, validation doesn’t start until a postback is requested. Steps to be followed

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Check if a control contains data. Properties – ControltoValidate – the control id which is to be validated. – ErrorMessage – the error message to be shown when validation occurs. – InitialValue - Error is thrown when this value does not change. – Enabled - to make the validation enabled. Required Field Validation

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Check if an entered item matches a specified format (Expression) Properties – ControltoValidate – ErrorMessage – InitialValue – ValidationExpression – Enabled Regular Expression Validator

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company RequiredFieldValidator RegularExpressionValidator Demo

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company A regular expression is a string that contains special symbols that can be used to match patterns of characters. Ex: dir *.* Means “Display all files in the current directory.” Demo

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company “.”- Matches one character “$”-Mathces pattern at the end of the string. Ex: (hello)$ I said hello (Matches) Did you say hello? (Does not match) “^”- Matches patterns at the beginning of a string. When used in [ ], reverses the meaning [i.e. not] Ex: [^aeiou] – Match any one character other than in the list Regular Expression Elements

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company { }- Used to match certain quantity of characters. – Ex: hello{2} –matches a string “hellohello” [ ]- Used to match any one of characters. – Ex: [aeiou] – Matches any one from list – Ex: [a-z] – To specify range. ()- Used for grouping strings Regular Expression Elements

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company “|”- Means logical OR – Ex: (hello)|(HELLO)- Match either “hello” or “HELLO”. “*”- Matches zero or more mathces – Ex: h*ello- Matches zero or more occurrences of the letter h, followed by ”ello”. “+”- Matches one or more matches – Ex: h+ello- Matches one or more occurrences of the letter h, followed by ”ello”. But not ”ello”. Regular Expression Elements

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company “?”- Matches zero or one occurrence – Ex: h?ello -Matches “ello” and “hello” but not “hhhello”. “\” – An escape character. When any of the previous character are preceded by the backslash, they are matched literally. – Ex: h\*ello- Matches “h*ello” but not “h\*ello” Regular Expression Elements

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company First to validate a number sequence \d{6} (indian Pincode) \d{3}-\d{2}-\d{4} Few regular Expressions

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company address validation So what does \w mean --- It means a word can occur. + means or * means zero or more occurances. Few regular Expressions

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company It is used when you want to group all the error messages at one location. Used to group all the error messages. Demo Validation Summary

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Exercise

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company What is validation? Why to validate data on a webform? Controls to validate. Using Regular expressions Using Validation Summary Exercise

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company

AUC Technologies Projects Consulting, Development, Mentoring, and Training Company Questions ?