Validation Controls: By: Dr. Deepak Mathur
Validation Controls: By: Dr. Deepak Mathur
Validation Controls: By: Dr. Deepak Mathur
VALIDATION CONTROLS89
Dr. Deepak Mathur LMCST (ASP.NET )
VALIDATION CONTROLS
Need of Validation control
2
Dr. Deepak Mathur LMCST (ASP.NET )
VALIDATION CONTROLS
Why needed ?
3
Dr. Deepak Mathur LMCST (ASP.NET )
VALIDATION CONTROLS
ASP.NET provides a third category of control known as
validation control.
Examples:
RequiredFieldValidator Control
CompareValidator Control
RangeValidator Control
RegularExpressionValidator Control
ValidationSummary Control
CustomValidator Control
4
Dr. Deepak Mathur LMCST
(ASP.NET )
REQUIREDFIELDVALIDATOR CONTROL
5
Dr. Deepak Mathur LMCST (ASP.NET )
Properties
ID
ControlToValidate
Display
ErrorMessage
RunAt
6
Dr. Deepak Mathur LMCST (ASP.NET )
Display Property………………………
7
Dr. Deepak Mathur LMCST (ASP.NET )
8
Dr. Deepak Mathur LMCST (ASP.NET )
COMPAREVALIDATOR CONTROL
9
Dr. Deepak Mathur LMCST (ASP.NET )
Properties
ID
ControlToValidate
Display
ErrorMessage
RunAt
ControlToCompare or ValueToCompare
10
Dr. Deepak Mathur LMCST (ASP.NET )
RANGEVALIDATOR CONTROL
11
Dr. Deepak Mathur LMCST (ASP.NET )
Properties
ID
ControlToValidate
Display
ErrorMessage
RunAt
MaximumValue
MinimumValue
MaximumControl
MinimumControl
Type
12
Dr. Deepak Mathur LMCST (ASP.NET )
13
Dr. Deepak Mathur LMCST (ASP.NET )
REGULAREXPRESSIONVALIDATOR CONTROL
14
Dr. Deepak Mathur LMCST (ASP.NET )
Properties
ID
ControlToValidate
Display
ErrorMessage
RunAt
ValidationExpression
15
Dr. Deepak Mathur LMCST (ASP.NET )
[ ]
range of alphabets or digits
{ }
number of occurrence
/s
space
_
Dash is required
16
Dr. Deepak Mathur LMCST (ASP.NET )
17
Dr. Deepak Mathur LMCST (ASP.NET )
[ a-z ]
Means alphabets from a to z
[ A-Z ]
Means alphabets from A to Z
[0-9]
Means Digits from 0 to 9
18
Dr. Deepak Mathur LMCST (ASP.NET )
19
Dr. Deepak Mathur LMCST (ASP.NET )
VALIDATIONSUMMARY CONTROL
Properties
ID
RunAt
DisplayMode >list ,bulletedlist
HeaderText
ShowMessageBox > whether to display or not
ShowSummary
20
Dr. Deepak Mathur LMCST (ASP.NET )
21
Dr. Deepak Mathur LMCST (ASP.NET )
CUSTOMVALIDATOR CONTROL
Properties
ID
ControlToValidate
Display
ErrorMessage
RunAt
ClientValidationFunction ??????????????
22
Dr. Deepak Mathur LMCST (ASP.NET )
23
Dr. Deepak Mathur LMCST (ASP.NET )
24
Dr. Deepak Mathur LMCST (ASP.NET )
DYNAMIC CONTROLS
What are these ?
These are the controls that are not created at compile time.
If not at compile time then at which time?
the ans is at RUNTIME
25
Dr. Deepak Mathur LMCST (ASP.NET )
DYNAMIC CONTROLS
Source Code
<script language="vb" runat="server">
Sub Page_Load(sender as Object, e as EventArgs)
26
Dr. Deepak Mathur LMCST (ASP.NET )
Errors
CompileTime
Semantic
RunTime
Debugging
27
Dr. Deepak Mathur LMCST (ASP.NET )
28
Dr. Deepak Mathur LMCST (ASP.NET )
29
Dr. Deepak Mathur LMCST (ASP.NET )
The mode attribute of the <customErrors> tag can take three values:
On: Indicates that the custom error messages are always sent to
users and that the detailed ASP.NET error page is never shown.
Off: Indicates that only original error messages are sent to users
even if a custom error page is available.
RemoteOnly: Indicates that the custom error messages are displayed
only to remote users accessing the site. If no custom error page is
available, remote users simply see a message indicating that an
error has occurred.
30
Dr. Deepak Mathur LMCST (ASP.NET )
<customErrors mode="RemoteOnly"
defaultRedirect=“a.aspx"/>
31
Dr. Deepak Mathur LMCST (ASP.NET )
A.ASPX FILE
<html>
<body>
<b> Sorry for the error occurred. For further assistance
contact the System Administrator
Email : [email protected]
Mob : 1111111111
</b>
</body>
</html>
32
Dr. Deepak Mathur LMCST (ASP.NET )
33
Dr. Deepak Mathur LMCST (ASP.NET )
<configuration>
<system.web>
<customErrors
defaultRedirect="http://host1/a.aspx" mode="RemoteOnly">
<error statusCode="500"
redirect="http://host1/pages/b.html"/>
<error statusCode="403"
redirect="http://host1/pages/c.html"/>
</customErrors>
</system.web>
</configuration
34
Dr. Deepak Mathur LMCST (ASP.NET )
35
Dr. Deepak Mathur LMCST (ASP.NET )
36
Dr. Deepak Mathur LMCST (ASP.NET )
Step Out
37
Dr. Deepak Mathur LMCST (ASP.NET )
38
Dr. Deepak Mathur LMCST (ASP.NET )
Source of
Malfunctioning
39
Dr. Deepak Mathur LMCST (ASP.NET )
40
Dr. Deepak Mathur LMCST (ASP.NET )
2.TRACING
TRACECONTEXT CLASS
Properties of the TraceContext class
1.IsEnable
2.TraceMode
2.1 Alphabetically
42
Dr. Deepak Mathur LMCST (ASP.NET )
43
Dr. Deepak Mathur LMCST (ASP.NET )
PAGE-LEVEL TRACING
Has to be made
True
44
Dr. Deepak Mathur LMCST (ASP.NET )
45
Dr. Deepak Mathur LMCST (ASP.NET )
APPLICATION-LEVEL TRACING
Application-level Tracing is enabled by using the Web.config file.
Here is the web.config file code:
<configuration>
<system.web>
<trace
enabled="true"
requestlimit="10"
pageoutput="false"
tracemode="SortByTime"
/>
</system.web>
</configuration>
46
Dr. Deepak Mathur LMCST (ASP.NET )
APPLICATION-LEVEL TRACING
Attributes of the Trace element
1. enabled
2. requestlimit
3. pageoutput
3.1 true
3.2 false
4. tracemode
4.1 sorted by time
4.2 sorted by category
47
Dr. Deepak Mathur LMCST (ASP.NET )
48
Dr. Deepak Mathur LMCST (ASP.NET )
THANK YOU
UNIT 3 ENDS
49