SlideShare a Scribd company logo
1 of 57
1
A Programme Under the Compumitra Series
The logic of validation allows us to move between the
two limits of dogmatism and skepticism.
- Paul Ricoeur
dogmatism = prejudiced, intolerant of a different opinion.
skepticism = doubt about the truth of something.
PROJECT: FEEDBACK FORM
Form Validation Controls - VB
LAB WORK GUIDE
2
OUTLINE
Form Validation Controls using VB
Example Template Creation.
Code Creation.
Output Evaluation.
Code Explanation.
Modification Trials
Error Trials
Practice Exercise.
Review Summary.
References.
3
Form Validation Controls
There are 5 commonly used validation techniques that shall be explained in next
few slides. These are:
RegularExpressionValidator – To match input to a given pattern.
RequiredFieldValidator – To make sure that a field is filled by the user.
RangeValidator – To check input to fall between in a set of values
CompareValidator – To match values given into two fields.
CustomValidator – Based on functionality given by the user.
Here we shall try to explain you methods to check if the values put in different fields of a form are
correct as per user defined criteria. This checking is also known as VALIDATION.
We will try to create a sample project, the way you must have seen on different websites to fill
feedbacks etc. For your convenience the HTML template portion of the code shall be given to you
for direct copying and rest you will have to follow the actions in this presentation.
4
UNDERSTANDING PROJECT STEPS
To make the process easier for you we shall follow these steps in making this project
Creation of a basic .aspx file.
Copying HTML Template code to quickly create a form.
Putting Required Validation Controls One By One.
Putting Button Control for Form Submission and Reset.
Putting a Panel Control to Show Project Output.
Putting Server Side Code for Custom Validation and other things.
5
Creation of basic .aspx file
6
"VB" VB
Creation of Client Side File
• Follow Standard Website Creation Steps and set your path to
C:Learner<student-id>ProjestsProject1VB
• Add New Default.aspx page in your Website
7
Adding HTML Form Template code
8
<h1 align="center">FEEDBACK FORM</h1>
<table cellpadding="5" cellspacing="2" width="70%" border="5" align="center">
<tr>
<td width="20%">
Name:
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server" Width="409px"></asp:TextBox>
</td>
</tr>
<tr>
<td width="20%">
Sex:
</td>
<td >
<asp:DropDownList ID="DropDownList1" runat="server" Height="18px" Width="97px">
<asp:ListItem Selected="True">--Select--</asp:ListItem>
<asp:ListItem>male</asp:ListItem>
<asp:ListItem >Female</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td width="20%">
Age:
</td>
<td>
<asp:TextBox ID="TextBox2" runat="server" Style="margin-left: 0px" Width="98px"></asp:TextBox>
</td>
</tr>
HTML Template code-1
Copy/Paste this code after the Div tag in Source view
9
<tr>
<td width="20%">
Email
</td>
<td>
<asp:TextBox ID="TextBox3" runat="server" Width="409px"></asp:TextBox>
</td>
</tr>
<tr>
<td width="20%">
Re-Enter Email
</td>
<td>
<asp:TextBox ID="TextBox4" runat="server" Style="margin-left: 0px" Width="409px"></asp:TextBox>
</td>
</tr>
<tr>
<td width="20%" valign="top">
Feedback
</td>
<td align="left">
<asp:TextBox ID="TextBox5" runat="server" Style="margin-left: 0px" Width="409px"
Rows="5" TextMode="MultiLine"></asp:TextBox>
</td>
</tr>
</table>
<br />
HTML Template code-2
Copy/Paste this code after previously pasted code
10
Template Design View
Design view of Given template
•Go to design view by clicking
on 'Design' tab.
11
Putting Required Validation Controls
12
Putting Validation Controls: RegularExpressionValidator-1
1-Introduce a new line and Drag and Drop a
'RegularExpressionValidator' Validation control here.
2-Set 'Display' property equal to
'Dynamic'
3-And 'ErrorMessage' property
equal to 'Only alphabets are
allowed'.
4-Set 'ControlToValidate'
property equal to 'TextBox1'.
5-Set 'SetFocusOnError' property equal
to 'True'
6-And 'ValidationExpression' property
equal to '^([a-zA-z s]{0,500})$'
13
Putting Validation Controls: RequiredFieldValidator
1-Introduce a new line and Drag and Drop a
'RequiredFieldValidator' Validation control here.
2-Set 'Display' property equal to
'Dynamic'
3-And 'ErrorMessage' property equal to
'This is a required field'.
4-Set 'ControlToValidate' property
equal to 'DropDownList1'.
5-Set 'InitialValue' property equal to '--
Select--'
6-Set 'SetFocusOnError' property equal
to 'True'
14
Putting Validation Controls: RangeValidator
1-Introduce a new line and Drag and Drop a
'RangeValidator' Validation control here.
2-Set 'Display' property equal to 'Dynamic'
3-Set 'ErrorMessage' property equal to 'Only
the age value between 10 to 100 is
permitted'.
4-Set 'ControlToValidate'
property equal to 'TextBox2'.
8-Set 'Type' property equal to
'Integer'.
5-Set 'MaximumValue' property
equal to '100'
6-Set 'MinimumValue' property
equal to '10'.
7-Set 'SetFocusOnError'
property equal to 'True' And
15
Putting Validation Controls: RegularExpressionValidator-2
1-Introduce a new line
and Drag and Drop a
'RegularExpressionVali
dator' Validation
control here.
4-Set 'ControlToValidate' property
equal to 'TextBox3'.
2-Set 'Display' property
equal to 'Dynamic'
3-And 'ErrorMessage'
property equal to Provide
email in the correct format
such as abc@abc.com'.
5-Set 'SetFocusOnError' property equal
to 'True'
6-And 'ValidationExpression' property
equal to 'w+([-+.']w+)*@w+([-
.]w+)*.w+([-.]w+)*'
16
Putting Validation Controls: CompareValidator
1. First introduce a new line and Drag and
Drop a 'CompareValidator' Validation
control then set their given properties.
4. Set 'ControlToCompare'
property equal to 'TextBox3'.
5. And 'ControlToValidate'
property equal to 'TextBox4'.
2. Set 'Display' property equal to
'Dynamic'
3. Set 'ErrorMessage' property equal to
'Both email addresses should be same'.
6. Set 'SetFocusOnError' property
equal to 'True'.
17
Putting Validation Controls: CustomValidator-1
1. Drag and Drop a 'CustomValidator' Validation
control then set their given properties.
4. Set 'ControlToValidate' property
equal to 'TextBox1'.
2. Set 'Display' property equal to
'Dynamic'
3. And 'ErrorMessage' property equal to
'You must type between 4 to 50
Characters in the Name field'.
5. Set 'SetFocusOnError' property
equal to 'True'.
18
Putting Validation Controls: CustomValidator-2
1. First introduce a new line and Drag and Drop
a 'CustomValidator' Validation control then set
their given properties.
4. Set 'ControlToValidate' property
equal to 'TextBox5'.
2. Set 'Display' property equal to
'Dynamic'
3. And 'ErrorMessage' property equal to
'You must type between 10 to 300
Characters in the FeedBack field'.
5. Set 'SetFocusOnError'
property equal to 'True'.
19
Putting DIV HTML Controls for Submission
and Reset Button
20
DIV Placement for Button Control
1. Introduce a new line and Drag
and Drop a 'DIV' Html control
from HTML Toolbox.
2. Set 'Align' property equal
to 'center' for all.
21
Putting Button Controls for Form
Submission and Reset
22
Submit Button Placement
1. Drag and Drop 'Button' in newly
added DIV.
2. And set 'Text' property equal to
'Submit'
23
Reset Button Placement
1. Drag and Drop 'Button' in DIV
2. And set 'Text' property equal
to 'Reset'
24
Putting DIV HTML Controls for Panel
Control
25
DIV Placement for Panel Control
2. Set 'Align' property equal
to 'center' for all.
1. Introduce a new line and Drag
and Drop a 'DIV' Html control
from HTML Toolbox.
26
Putting a Panel Control to Show
Project Output
27
Panel Control Placement
1. Drag and Drop a 'Panel'
control in newly added DIV. 2. Set 'BorderStyle'
property equal to 'Groove'
3. And 'BorderWidth'
property equal to '1px'.
5. Set 'Height' property equal to '150px',
'HorizontalAlign' equal to 'Left', 'ScrollBars' property
equal to 'Both' and 'Width' property equal to '70%'.
4. Set 'Visible' property
equal to 'False' for all.
28
Table Creation in Panel Control
29
Table Creation
2. Set 'Rows:' equal to '5' and
'Columns:' equal to '2' for all.
'Insert Table' dialog Box will open.
3. Set 'Specify width:' equal
to '90' in percent.
4. Then click on 'OK'
button.
1. Click on 'Insert Table' in
'Table' menu.
30
Label Control Placement
Type 'Name', 'Sex', 'Age', 'Email ID'
and 'Feed Back' in First Column of
the Table According to given
Template
31
Output Place Holders Placement
1. Drag and drop 5 'Label' controls in
second Column According to given
Template.
2. Set 'Text' property equal to
'Blank' for all.
32
Putting Server Side Code for Custom
Validation and other things
33
If Page.IsValid = True Then
Label1.Text = TextBox1.Text
Label2.Text = DropDownList1.SelectedItem.Text
Label3.Text = TextBox2.Text
Label4.Text = TextBox3.Text
Label5.Text = TextBox5.Text
Panel1.Visible = True
End If
Server Side Code For Submit Button
Copy/Paste or Type this code in Button1_Click Event
Handler.
• Generate the Button1_Click handler in the VB code by double-clicking
over the Submit button control of aspx file.
34
Server Side Code For Reset Button
TextBox1.Text = ""
DropDownList1.SelectedIndex = 0
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
Panel1.Visible = False
Label1.Text = ""
Label2.Text = ""
Label3.Text = ""
Label4.Text = ""
Label5.Text = ""
Copy/Paste or Type this code in
Button2_Click Event Handler.
• Generate the Button2_Click handler in the VB code by double-clicking
over the Reset button control of .aspx file.
35
If (args.Value.Length < 4 Or args.Value.Length > 50) Then
args.IsValid = False
Else
args.IsValid = True
End If
Server Side Code For Name Character Count
Copy/Paste or Type this code in
CustomValidator1_ServerValidate
Event Handler.
• Generate the CustomValidator1_ServerValidate validation handler in the
VB code by double-clicking over the CustomValidator1 control in the
design view of .aspx file.
36
If (args.Value.Length < 10 Or args.Value.Length > 300) Then
args.IsValid = False
Else
args.IsValid = True
End If
Server Side Code For Feed Back Character Count
• Generate the CustomValidator2_ServerValidate validation handler in the
VB code by double-clicking over the CustomValidator2 control in the
design view of .aspx file.
Copy/Paste or Type this code in
CustomValidator2_ServerValidate Event
Handler.
Run Code By pressing 'F5'
37
Outputs of Project
38
--Select--
Output of Project-1
RangeValidator1 Ensures that the
value of an input should be between
10 to 100.
Outputs on browser
RegularExpressionValidator Ensures
that the value of an input should be
alphabets.
RegularExpressionValidator Ensures
that the provided email id should
be in correct format
--Select--
39
--Select--
Output of Project-2
Output on browser after clicking Submit Button RequiredFieldValidator makes
this field as required field.
CompareValidator compares the
value of this field with EmailID field.
CustomValidator restrict the no of
input characters in a particular field.
Output on browser after clicking
Submit Button
40
Output of Project-3
Fill the required information correctly
and then click on Submit button.
After clicking Submit button your
given information will display in panel.
Outputs on browser
Click on Reset button. Text area
of All the fields will set blank.
--Select--
41
Code Explanation
42
.aspx Code Explanation-1
<asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox1"
OnServerValidate="CustomValidator1_ServerValidate " SetFocusOnError="True" Display="Dynamic">
You must type between 4 to 50 Characters in the name field </asp:CustomValidator>
This statement creates a validation control
CustomValidator for Name field.
ControlToValidate property define
that which control will be validate.
Here this property set to "TextBox1"
i.e. TextBox of Name field.
OnServerValidate property Specifies the name of
the server-side validation function
('NameCharacterCount' function) to be executed.
43
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ValidationExpression="^([a-zA-z s]{0,500})$" ControlToValidate="TextBox1" SetFocusOnError="True"
ErrorMessage="Only alphabets are allowed" Display="Dynamic"></asp:RegularExpressionValidator>
.aspx Code Explanation-2
This statement creates a validation control
RegularExpressionValidator for Name field. ValidationExpression property
Specifies the expression used to
validate input control .
ErrorMessage property set the text to display
the error message, when validation fails.
ValidationExpression="^([a-zA-z s]{0,500})$"
'[a-zA-zs]' part of the string define that
the validate control takes only upper
case or lower case English alphabet.
'{0,500}' part of the string define that the
validate control takes minimum '0'
character and maximum '500' characters.
44
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="DropDownList1" Display="Dynamic" ErrorMessage="This is a required field"
SetFocusOnError="True" InitialValue="--Select--"></asp:RequiredFieldValidator>
.aspx Code Explanation-3
This statement creates a validation control
RequiredFieldValidator, which makes the Sex
field as required field.
SetFocusOnError property set the
focus of the cursor on validating
control, when validation fails.
InitialValue property set the initial
value of the control which is
treated as null value by
RequiredFieldValidator control.
45
.aspx Code Explanation-4
<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="TextBox2"
MaximumValue="100" MinimumValue="10" SetFocusOnError="True" Type="Integer" Display="Dynamic">
Only the age value between 10 to 100 is permitted</asp:RangeValidator>
This statement creates a validation control
RangeValidator for Age field.
MaximumValue property set the
maximum input value for the
validating control.
MinimumValue property set the minimum
input value for the validating control.
Type property set the input type for
the validating control.
46
<asp:CompareValidator ID="CompareValidator2" runat="server" ControlToCompare="TextBox4"
ControlToValidate="TextBox5" SetFocusOnError="True" Display="Dynamic">
Both email addresses should be same </asp:CompareValidator>
.aspx Code Explanation-5
<asp:CustomValidator ID="CustomValidator2" runat="server"
OnServerValidate="CustomValidator2_ServerValidate" ControlToValidate="TextBox5"
SetFocusOnError="True" Display="Dynamic">
You must type between 10 to 300 Characters in the FeedBack field</asp:CustomValidator>
This statement creates a validation control
CompareValidator, which Compare the value
of validating control with specified control
ControlToCompare property The ID
of the control to compare with.
This statement creates a validation control
CustomValidator for Feed Back field.
OnServerValidate property Specifies the name of the
server-side validation function
('CustomValidator2_ServerValidate' function) to be
executed.
47
If Page.IsValid = True Then
Label1.Text = TextBox1.Text
Label2.Text = DropDownList1.SelectedItem.Text
Label3.Text = TextBox2.Text
Label4.Text = TextBox3.Text
Label5.Text = TextBox5.Text
Panel1.Visible = True
End If
Server Side Code Explanation-1
These statements assign the
TEXT property of Labels.
Page.IsValid property is used to
check whether a page is valid
or not on button1 (Submit
button) click event.
These statements reset the
page on Button2 (Reset
button) click event.
TextBox1.Text = ""
DropDownList1.SelectedIndex = 2
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
Panel1.Visible = False
Label1.Text = ""
Label2.Text = ""
Label3.Text = ""
Label4.Text = ""
Label5.Text = ""
48
Server Side Code Explanation-2
args.Value.Length count the no.
of characters in argument.
If (args.Value.Length < 4 Or args.Value.Length > 50) Then
args.IsValid = False
Else
args.IsValid = True
End If
If (args.Value.Length < 10 Or args.Value.Length > 300) Then
args.IsValid = False
Else
args.IsValid = True
End If
49
Modification Trials -1
Set the Display property equal to Static for all
validation controls and run code.
Watch the effect.
Try to use RequiredFieldValidator validation control
with EmailID field.
Run and watch the effect.
Try to change the ForeColor property of
RangeValidator control Red to Blue.
Run and watch the effect.
50
Modification Trials-2
Remove CustomValidator control and it's .aspx.vb
code from Name field and change property
ValidationExpression="^([a-zA-z s]{0,500})$" to
ValidationExpression="^([a-zA-z s]{4,50})$" of
RegularExpressionValidator control.
Run and watch that when you will enter less then 4
characters or more then 50 characters, it will display
"Only alphabets are allowed" error message.
Try to increase the no. of characters limit of FeedBack
field from 300 to 500.
51
Error Trials
 Change ValidationExpression property from "^([a-zA-z s]{0,500})$"
to "^([a-zA-z s])$" of RegularExpressionValidator control.
See that when you gives any input, Validation controls of Name field
produce an error message.
52
Error Trials-2
 Re-store the original code and change ValidationExpression
property from "^([a-zA-z s]{0,500})$" to "^([a-zA-z s]{4,50})$"
of RegularExpressionValidator control of Name field.
See that when you gives invalid input in Name field, it produce
same error message i.e.
53
For further assistance take the help of your instructor or
Internet.
Practice Exercise
Create a project for Daily Sales Entry Form, which
have 5 fields namely Item ID, Item Price, Sales
Quantity, Sales By, Sales Price.
Program Should be calculate Sales Price
Formula for Sales Price Calculation
Sales Price = Item Price X Sales Quantity
Instructions
Item ID must be a Required Field.
Item Price must be a 5 digits number
Sales Quantity must be a required field
Sales By field should be accept 3 to 40 alphabets only.
User cannot enter any value in Sales Price field (Set
‘Enabled’ property of TextBox Control).
54
Design View of Practice Exercise
Design View of Practice Exercise
55
Learning Summary Review
Use of ASP:CustomValidator
Use of ASP:RegularExpressionValidator
Use of ASP:RequiredFieldValidator
Use of ASP:RangeValidator
Use of ASP:CompareValidator
Use of Panel
56
Bibliography
 ASP:CustomValidator: http://msdn.microsoft.com/en-
us/library/9eee01cx(v=VS.71).aspx
 ASP:RegularExpressionValidator:
http://msdn.microsoft.com/en-
us/library/eahwtc9e(v=VS.71).aspx
 ASP:RequiredFieldValidator: http://msdn.microsoft.com/en-
us/library/5hbw267h(v=VS.71).aspx
 ASP:RangeValidator: http://msdn.microsoft.com/en-
us/library/f70d09xt(v=VS.71).aspx
 ASP:CompareValidator: http://msdn.microsoft.com/en-
us/library/db330ayw(v=VS.71).aspx
57
Ask and guide me at
sunmitraeducation@gmail.com
Share this information with as
many people as possible.
Keep visiting www.sunmitra.com
for programme updates.

More Related Content

What's hot

Chapter 07
Chapter 07Chapter 07
Chapter 07llmeade
 
Chapter 3 — Program Design and Coding
Chapter 3 — Program Design and Coding Chapter 3 — Program Design and Coding
Chapter 3 — Program Design and Coding francopw
 
Smart todolist
Smart todolistSmart todolist
Smart todolistAppSheet
 
Eq hub operator_contractor_user_guide
Eq hub operator_contractor_user_guideEq hub operator_contractor_user_guide
Eq hub operator_contractor_user_guideEqHub
 
Chapter 05
Chapter 05Chapter 05
Chapter 05llmeade
 
Detail Views
Detail ViewsDetail Views
Detail ViewsEMAINT
 
Tutorials on Macro
Tutorials on MacroTutorials on Macro
Tutorials on MacroAnurag Deb
 
Tips and Tricks
Tips and TricksTips and Tricks
Tips and TricksEMAINT
 
Chapter 08
Chapter 08Chapter 08
Chapter 08llmeade
 
Fomatting Text Tips
Fomatting Text TipsFomatting Text Tips
Fomatting Text TipsEMAINT
 
Creating Purcahse Orders
Creating Purcahse OrdersCreating Purcahse Orders
Creating Purcahse OrdersEMAINT
 
Chapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface DesignChapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface Designfrancopw
 
Customizing Forms
Customizing FormsCustomizing Forms
Customizing FormsEMAINT
 
Chapter 4 — Variables and Arithmetic Operations
Chapter 4 — Variables and Arithmetic OperationsChapter 4 — Variables and Arithmetic Operations
Chapter 4 — Variables and Arithmetic Operationsfrancopw
 
Create chart of account
Create chart of accountCreate chart of account
Create chart of accountHassan Fadl
 

What's hot (20)

Chapter 07
Chapter 07Chapter 07
Chapter 07
 
Excel300
Excel300Excel300
Excel300
 
Chapter 3 — Program Design and Coding
Chapter 3 — Program Design and Coding Chapter 3 — Program Design and Coding
Chapter 3 — Program Design and Coding
 
Smart todolist
Smart todolistSmart todolist
Smart todolist
 
Req pro tips
Req pro tipsReq pro tips
Req pro tips
 
Basics of Ms Excel Office Tool
Basics of Ms Excel Office ToolBasics of Ms Excel Office Tool
Basics of Ms Excel Office Tool
 
Eq hub operator_contractor_user_guide
Eq hub operator_contractor_user_guideEq hub operator_contractor_user_guide
Eq hub operator_contractor_user_guide
 
Chapter 05
Chapter 05Chapter 05
Chapter 05
 
Detail Views
Detail ViewsDetail Views
Detail Views
 
Excel 2007- Enter Formulas
Excel 2007- Enter FormulasExcel 2007- Enter Formulas
Excel 2007- Enter Formulas
 
Tutorials on Macro
Tutorials on MacroTutorials on Macro
Tutorials on Macro
 
Tips and Tricks
Tips and TricksTips and Tricks
Tips and Tricks
 
Chapter 08
Chapter 08Chapter 08
Chapter 08
 
Fomatting Text Tips
Fomatting Text TipsFomatting Text Tips
Fomatting Text Tips
 
Creating Purcahse Orders
Creating Purcahse OrdersCreating Purcahse Orders
Creating Purcahse Orders
 
Tutorials2
Tutorials2Tutorials2
Tutorials2
 
Chapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface DesignChapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface Design
 
Customizing Forms
Customizing FormsCustomizing Forms
Customizing Forms
 
Chapter 4 — Variables and Arithmetic Operations
Chapter 4 — Variables and Arithmetic OperationsChapter 4 — Variables and Arithmetic Operations
Chapter 4 — Variables and Arithmetic Operations
 
Create chart of account
Create chart of accountCreate chart of account
Create chart of account
 

Similar to Project1 VB

validation-controls.pdf ioue8n uoh souu o3i
validation-controls.pdf ioue8n uoh souu  o3ivalidation-controls.pdf ioue8n uoh souu  o3i
validation-controls.pdf ioue8n uoh souu o3iCoRRexGaMing
 
Validation controls in asp
Validation controls in aspValidation controls in asp
Validation controls in aspShishir Jain
 
LAYERS asp.net ppt
LAYERS asp.net pptLAYERS asp.net ppt
LAYERS asp.net pptIMEI
 
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docxCSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docxruthannemcmullen
 
Web Server Controls VB Set 1
Web Server Controls VB Set 1Web Server Controls VB Set 1
Web Server Controls VB Set 1sunmitraeducation
 
Ajax control tool kit
Ajax control tool kitAjax control tool kit
Ajax control tool kitVidhi Patel
 
Cookbook Oracle SOA Business Rules
Cookbook Oracle SOA Business RulesCookbook Oracle SOA Business Rules
Cookbook Oracle SOA Business RulesEmiel Paasschens
 
Oracle business rules
Oracle business rulesOracle business rules
Oracle business rulesxavier john
 
A guide to proofing on Wrike with Moirae.pdf
A guide to proofing on Wrike with Moirae.pdfA guide to proofing on Wrike with Moirae.pdf
A guide to proofing on Wrike with Moirae.pdfArturTorresdeMelo1
 
Introduction to Custom Form Control
Introduction to Custom Form ControlIntroduction to Custom Form Control
Introduction to Custom Form ControlKnoldus Inc.
 
Elevate workshop programmatic_2014
Elevate workshop programmatic_2014Elevate workshop programmatic_2014
Elevate workshop programmatic_2014David Scruggs
 
C# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slidesC# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slidesSami Mut
 
Rc085 010d-vaadin7
Rc085 010d-vaadin7Rc085 010d-vaadin7
Rc085 010d-vaadin7Cosmina Ivan
 

Similar to Project1 VB (20)

Project1 CS
Project1 CSProject1 CS
Project1 CS
 
validation-controls.pdf ioue8n uoh souu o3i
validation-controls.pdf ioue8n uoh souu  o3ivalidation-controls.pdf ioue8n uoh souu  o3i
validation-controls.pdf ioue8n uoh souu o3i
 
Validation controls in asp
Validation controls in aspValidation controls in asp
Validation controls in asp
 
LAYERS asp.net ppt
LAYERS asp.net pptLAYERS asp.net ppt
LAYERS asp.net ppt
 
Wheels
WheelsWheels
Wheels
 
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docxCSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
 
Web Server Controls VB Set 1
Web Server Controls VB Set 1Web Server Controls VB Set 1
Web Server Controls VB Set 1
 
Mca 504 dotnet_unit5
Mca 504 dotnet_unit5Mca 504 dotnet_unit5
Mca 504 dotnet_unit5
 
Ajax control tool kit
Ajax control tool kitAjax control tool kit
Ajax control tool kit
 
Visual studio 2008 asp net
Visual studio 2008 asp netVisual studio 2008 asp net
Visual studio 2008 asp net
 
Web Server Controls CS Set
Web Server Controls CS Set Web Server Controls CS Set
Web Server Controls CS Set
 
Cookbook Oracle SOA Business Rules
Cookbook Oracle SOA Business RulesCookbook Oracle SOA Business Rules
Cookbook Oracle SOA Business Rules
 
Oracle business rules
Oracle business rulesOracle business rules
Oracle business rules
 
A guide to proofing on Wrike with Moirae.pdf
A guide to proofing on Wrike with Moirae.pdfA guide to proofing on Wrike with Moirae.pdf
A guide to proofing on Wrike with Moirae.pdf
 
Qtp day 3
Qtp day 3Qtp day 3
Qtp day 3
 
Asp PPT (.NET )
Asp PPT (.NET )Asp PPT (.NET )
Asp PPT (.NET )
 
Introduction to Custom Form Control
Introduction to Custom Form ControlIntroduction to Custom Form Control
Introduction to Custom Form Control
 
Elevate workshop programmatic_2014
Elevate workshop programmatic_2014Elevate workshop programmatic_2014
Elevate workshop programmatic_2014
 
C# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slidesC# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slides
 
Rc085 010d-vaadin7
Rc085 010d-vaadin7Rc085 010d-vaadin7
Rc085 010d-vaadin7
 

More from sunmitraeducation

Installing JDK and first java program
Installing JDK and first java programInstalling JDK and first java program
Installing JDK and first java programsunmitraeducation
 
Visual Web Developer and Web Controls VB set 3
Visual Web Developer and Web Controls VB set 3Visual Web Developer and Web Controls VB set 3
Visual Web Developer and Web Controls VB set 3sunmitraeducation
 
Visual Web Developer and Web Controls CS set 3
Visual Web Developer and Web Controls CS set 3Visual Web Developer and Web Controls CS set 3
Visual Web Developer and Web Controls CS set 3sunmitraeducation
 
Progamming Primer Polymorphism (Method Overloading) VB
Progamming Primer Polymorphism (Method Overloading) VBProgamming Primer Polymorphism (Method Overloading) VB
Progamming Primer Polymorphism (Method Overloading) VBsunmitraeducation
 
Programming Primer EncapsulationVB
Programming Primer EncapsulationVBProgramming Primer EncapsulationVB
Programming Primer EncapsulationVBsunmitraeducation
 
Programming Primer Encapsulation CS
Programming Primer Encapsulation CSProgramming Primer Encapsulation CS
Programming Primer Encapsulation CSsunmitraeducation
 
Programming Primer Inheritance VB
Programming Primer Inheritance VBProgramming Primer Inheritance VB
Programming Primer Inheritance VBsunmitraeducation
 
Programming Primer Inheritance CS
Programming Primer Inheritance CSProgramming Primer Inheritance CS
Programming Primer Inheritance CSsunmitraeducation
 
Html Server Image Control VB
Html Server Image Control VBHtml Server Image Control VB
Html Server Image Control VBsunmitraeducation
 
Html Server Image Control CS
Html Server Image Control CSHtml Server Image Control CS
Html Server Image Control CSsunmitraeducation
 
Html Server Anchor Control VB
Html Server Anchor Control VBHtml Server Anchor Control VB
Html Server Anchor Control VBsunmitraeducation
 
Html Server Anchor Control CS
Html Server Anchor Control CSHtml Server Anchor Control CS
Html Server Anchor Control CSsunmitraeducation
 
Html Server Input Radiobutton Control VB
Html Server Input Radiobutton Control VBHtml Server Input Radiobutton Control VB
Html Server Input Radiobutton Control VBsunmitraeducation
 

More from sunmitraeducation (20)

Java Introduction
Java IntroductionJava Introduction
Java Introduction
 
Installing JDK and first java program
Installing JDK and first java programInstalling JDK and first java program
Installing JDK and first java program
 
Grid Vew Control VB
Grid Vew Control VBGrid Vew Control VB
Grid Vew Control VB
 
Grid View Control CS
Grid View Control CSGrid View Control CS
Grid View Control CS
 
Database Basics Theory
Database Basics TheoryDatabase Basics Theory
Database Basics Theory
 
Visual Web Developer and Web Controls VB set 3
Visual Web Developer and Web Controls VB set 3Visual Web Developer and Web Controls VB set 3
Visual Web Developer and Web Controls VB set 3
 
Visual Web Developer and Web Controls CS set 3
Visual Web Developer and Web Controls CS set 3Visual Web Developer and Web Controls CS set 3
Visual Web Developer and Web Controls CS set 3
 
Progamming Primer Polymorphism (Method Overloading) VB
Progamming Primer Polymorphism (Method Overloading) VBProgamming Primer Polymorphism (Method Overloading) VB
Progamming Primer Polymorphism (Method Overloading) VB
 
Programming Primer EncapsulationVB
Programming Primer EncapsulationVBProgramming Primer EncapsulationVB
Programming Primer EncapsulationVB
 
Programming Primer Encapsulation CS
Programming Primer Encapsulation CSProgramming Primer Encapsulation CS
Programming Primer Encapsulation CS
 
Programming Primer Inheritance VB
Programming Primer Inheritance VBProgramming Primer Inheritance VB
Programming Primer Inheritance VB
 
Programming Primer Inheritance CS
Programming Primer Inheritance CSProgramming Primer Inheritance CS
Programming Primer Inheritance CS
 
ProgrammingPrimerAndOOPS
ProgrammingPrimerAndOOPSProgrammingPrimerAndOOPS
ProgrammingPrimerAndOOPS
 
Web Controls Set-1
Web Controls Set-1Web Controls Set-1
Web Controls Set-1
 
Understanding IDEs
Understanding IDEsUnderstanding IDEs
Understanding IDEs
 
Html Server Image Control VB
Html Server Image Control VBHtml Server Image Control VB
Html Server Image Control VB
 
Html Server Image Control CS
Html Server Image Control CSHtml Server Image Control CS
Html Server Image Control CS
 
Html Server Anchor Control VB
Html Server Anchor Control VBHtml Server Anchor Control VB
Html Server Anchor Control VB
 
Html Server Anchor Control CS
Html Server Anchor Control CSHtml Server Anchor Control CS
Html Server Anchor Control CS
 
Html Server Input Radiobutton Control VB
Html Server Input Radiobutton Control VBHtml Server Input Radiobutton Control VB
Html Server Input Radiobutton Control VB
 

Recently uploaded

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 

Recently uploaded (20)

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 

Project1 VB

  • 1. 1 A Programme Under the Compumitra Series The logic of validation allows us to move between the two limits of dogmatism and skepticism. - Paul Ricoeur dogmatism = prejudiced, intolerant of a different opinion. skepticism = doubt about the truth of something. PROJECT: FEEDBACK FORM Form Validation Controls - VB LAB WORK GUIDE
  • 2. 2 OUTLINE Form Validation Controls using VB Example Template Creation. Code Creation. Output Evaluation. Code Explanation. Modification Trials Error Trials Practice Exercise. Review Summary. References.
  • 3. 3 Form Validation Controls There are 5 commonly used validation techniques that shall be explained in next few slides. These are: RegularExpressionValidator – To match input to a given pattern. RequiredFieldValidator – To make sure that a field is filled by the user. RangeValidator – To check input to fall between in a set of values CompareValidator – To match values given into two fields. CustomValidator – Based on functionality given by the user. Here we shall try to explain you methods to check if the values put in different fields of a form are correct as per user defined criteria. This checking is also known as VALIDATION. We will try to create a sample project, the way you must have seen on different websites to fill feedbacks etc. For your convenience the HTML template portion of the code shall be given to you for direct copying and rest you will have to follow the actions in this presentation.
  • 4. 4 UNDERSTANDING PROJECT STEPS To make the process easier for you we shall follow these steps in making this project Creation of a basic .aspx file. Copying HTML Template code to quickly create a form. Putting Required Validation Controls One By One. Putting Button Control for Form Submission and Reset. Putting a Panel Control to Show Project Output. Putting Server Side Code for Custom Validation and other things.
  • 5. 5 Creation of basic .aspx file
  • 6. 6 "VB" VB Creation of Client Side File • Follow Standard Website Creation Steps and set your path to C:Learner<student-id>ProjestsProject1VB • Add New Default.aspx page in your Website
  • 7. 7 Adding HTML Form Template code
  • 8. 8 <h1 align="center">FEEDBACK FORM</h1> <table cellpadding="5" cellspacing="2" width="70%" border="5" align="center"> <tr> <td width="20%"> Name: </td> <td> <asp:TextBox ID="TextBox1" runat="server" Width="409px"></asp:TextBox> </td> </tr> <tr> <td width="20%"> Sex: </td> <td > <asp:DropDownList ID="DropDownList1" runat="server" Height="18px" Width="97px"> <asp:ListItem Selected="True">--Select--</asp:ListItem> <asp:ListItem>male</asp:ListItem> <asp:ListItem >Female</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td width="20%"> Age: </td> <td> <asp:TextBox ID="TextBox2" runat="server" Style="margin-left: 0px" Width="98px"></asp:TextBox> </td> </tr> HTML Template code-1 Copy/Paste this code after the Div tag in Source view
  • 9. 9 <tr> <td width="20%"> Email </td> <td> <asp:TextBox ID="TextBox3" runat="server" Width="409px"></asp:TextBox> </td> </tr> <tr> <td width="20%"> Re-Enter Email </td> <td> <asp:TextBox ID="TextBox4" runat="server" Style="margin-left: 0px" Width="409px"></asp:TextBox> </td> </tr> <tr> <td width="20%" valign="top"> Feedback </td> <td align="left"> <asp:TextBox ID="TextBox5" runat="server" Style="margin-left: 0px" Width="409px" Rows="5" TextMode="MultiLine"></asp:TextBox> </td> </tr> </table> <br /> HTML Template code-2 Copy/Paste this code after previously pasted code
  • 10. 10 Template Design View Design view of Given template •Go to design view by clicking on 'Design' tab.
  • 12. 12 Putting Validation Controls: RegularExpressionValidator-1 1-Introduce a new line and Drag and Drop a 'RegularExpressionValidator' Validation control here. 2-Set 'Display' property equal to 'Dynamic' 3-And 'ErrorMessage' property equal to 'Only alphabets are allowed'. 4-Set 'ControlToValidate' property equal to 'TextBox1'. 5-Set 'SetFocusOnError' property equal to 'True' 6-And 'ValidationExpression' property equal to '^([a-zA-z s]{0,500})$'
  • 13. 13 Putting Validation Controls: RequiredFieldValidator 1-Introduce a new line and Drag and Drop a 'RequiredFieldValidator' Validation control here. 2-Set 'Display' property equal to 'Dynamic' 3-And 'ErrorMessage' property equal to 'This is a required field'. 4-Set 'ControlToValidate' property equal to 'DropDownList1'. 5-Set 'InitialValue' property equal to '-- Select--' 6-Set 'SetFocusOnError' property equal to 'True'
  • 14. 14 Putting Validation Controls: RangeValidator 1-Introduce a new line and Drag and Drop a 'RangeValidator' Validation control here. 2-Set 'Display' property equal to 'Dynamic' 3-Set 'ErrorMessage' property equal to 'Only the age value between 10 to 100 is permitted'. 4-Set 'ControlToValidate' property equal to 'TextBox2'. 8-Set 'Type' property equal to 'Integer'. 5-Set 'MaximumValue' property equal to '100' 6-Set 'MinimumValue' property equal to '10'. 7-Set 'SetFocusOnError' property equal to 'True' And
  • 15. 15 Putting Validation Controls: RegularExpressionValidator-2 1-Introduce a new line and Drag and Drop a 'RegularExpressionVali dator' Validation control here. 4-Set 'ControlToValidate' property equal to 'TextBox3'. 2-Set 'Display' property equal to 'Dynamic' 3-And 'ErrorMessage' property equal to Provide email in the correct format such as abc@abc.com'. 5-Set 'SetFocusOnError' property equal to 'True' 6-And 'ValidationExpression' property equal to 'w+([-+.']w+)*@w+([- .]w+)*.w+([-.]w+)*'
  • 16. 16 Putting Validation Controls: CompareValidator 1. First introduce a new line and Drag and Drop a 'CompareValidator' Validation control then set their given properties. 4. Set 'ControlToCompare' property equal to 'TextBox3'. 5. And 'ControlToValidate' property equal to 'TextBox4'. 2. Set 'Display' property equal to 'Dynamic' 3. Set 'ErrorMessage' property equal to 'Both email addresses should be same'. 6. Set 'SetFocusOnError' property equal to 'True'.
  • 17. 17 Putting Validation Controls: CustomValidator-1 1. Drag and Drop a 'CustomValidator' Validation control then set their given properties. 4. Set 'ControlToValidate' property equal to 'TextBox1'. 2. Set 'Display' property equal to 'Dynamic' 3. And 'ErrorMessage' property equal to 'You must type between 4 to 50 Characters in the Name field'. 5. Set 'SetFocusOnError' property equal to 'True'.
  • 18. 18 Putting Validation Controls: CustomValidator-2 1. First introduce a new line and Drag and Drop a 'CustomValidator' Validation control then set their given properties. 4. Set 'ControlToValidate' property equal to 'TextBox5'. 2. Set 'Display' property equal to 'Dynamic' 3. And 'ErrorMessage' property equal to 'You must type between 10 to 300 Characters in the FeedBack field'. 5. Set 'SetFocusOnError' property equal to 'True'.
  • 19. 19 Putting DIV HTML Controls for Submission and Reset Button
  • 20. 20 DIV Placement for Button Control 1. Introduce a new line and Drag and Drop a 'DIV' Html control from HTML Toolbox. 2. Set 'Align' property equal to 'center' for all.
  • 21. 21 Putting Button Controls for Form Submission and Reset
  • 22. 22 Submit Button Placement 1. Drag and Drop 'Button' in newly added DIV. 2. And set 'Text' property equal to 'Submit'
  • 23. 23 Reset Button Placement 1. Drag and Drop 'Button' in DIV 2. And set 'Text' property equal to 'Reset'
  • 24. 24 Putting DIV HTML Controls for Panel Control
  • 25. 25 DIV Placement for Panel Control 2. Set 'Align' property equal to 'center' for all. 1. Introduce a new line and Drag and Drop a 'DIV' Html control from HTML Toolbox.
  • 26. 26 Putting a Panel Control to Show Project Output
  • 27. 27 Panel Control Placement 1. Drag and Drop a 'Panel' control in newly added DIV. 2. Set 'BorderStyle' property equal to 'Groove' 3. And 'BorderWidth' property equal to '1px'. 5. Set 'Height' property equal to '150px', 'HorizontalAlign' equal to 'Left', 'ScrollBars' property equal to 'Both' and 'Width' property equal to '70%'. 4. Set 'Visible' property equal to 'False' for all.
  • 28. 28 Table Creation in Panel Control
  • 29. 29 Table Creation 2. Set 'Rows:' equal to '5' and 'Columns:' equal to '2' for all. 'Insert Table' dialog Box will open. 3. Set 'Specify width:' equal to '90' in percent. 4. Then click on 'OK' button. 1. Click on 'Insert Table' in 'Table' menu.
  • 30. 30 Label Control Placement Type 'Name', 'Sex', 'Age', 'Email ID' and 'Feed Back' in First Column of the Table According to given Template
  • 31. 31 Output Place Holders Placement 1. Drag and drop 5 'Label' controls in second Column According to given Template. 2. Set 'Text' property equal to 'Blank' for all.
  • 32. 32 Putting Server Side Code for Custom Validation and other things
  • 33. 33 If Page.IsValid = True Then Label1.Text = TextBox1.Text Label2.Text = DropDownList1.SelectedItem.Text Label3.Text = TextBox2.Text Label4.Text = TextBox3.Text Label5.Text = TextBox5.Text Panel1.Visible = True End If Server Side Code For Submit Button Copy/Paste or Type this code in Button1_Click Event Handler. • Generate the Button1_Click handler in the VB code by double-clicking over the Submit button control of aspx file.
  • 34. 34 Server Side Code For Reset Button TextBox1.Text = "" DropDownList1.SelectedIndex = 0 TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" Panel1.Visible = False Label1.Text = "" Label2.Text = "" Label3.Text = "" Label4.Text = "" Label5.Text = "" Copy/Paste or Type this code in Button2_Click Event Handler. • Generate the Button2_Click handler in the VB code by double-clicking over the Reset button control of .aspx file.
  • 35. 35 If (args.Value.Length < 4 Or args.Value.Length > 50) Then args.IsValid = False Else args.IsValid = True End If Server Side Code For Name Character Count Copy/Paste or Type this code in CustomValidator1_ServerValidate Event Handler. • Generate the CustomValidator1_ServerValidate validation handler in the VB code by double-clicking over the CustomValidator1 control in the design view of .aspx file.
  • 36. 36 If (args.Value.Length < 10 Or args.Value.Length > 300) Then args.IsValid = False Else args.IsValid = True End If Server Side Code For Feed Back Character Count • Generate the CustomValidator2_ServerValidate validation handler in the VB code by double-clicking over the CustomValidator2 control in the design view of .aspx file. Copy/Paste or Type this code in CustomValidator2_ServerValidate Event Handler. Run Code By pressing 'F5'
  • 38. 38 --Select-- Output of Project-1 RangeValidator1 Ensures that the value of an input should be between 10 to 100. Outputs on browser RegularExpressionValidator Ensures that the value of an input should be alphabets. RegularExpressionValidator Ensures that the provided email id should be in correct format --Select--
  • 39. 39 --Select-- Output of Project-2 Output on browser after clicking Submit Button RequiredFieldValidator makes this field as required field. CompareValidator compares the value of this field with EmailID field. CustomValidator restrict the no of input characters in a particular field. Output on browser after clicking Submit Button
  • 40. 40 Output of Project-3 Fill the required information correctly and then click on Submit button. After clicking Submit button your given information will display in panel. Outputs on browser Click on Reset button. Text area of All the fields will set blank. --Select--
  • 42. 42 .aspx Code Explanation-1 <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox1" OnServerValidate="CustomValidator1_ServerValidate " SetFocusOnError="True" Display="Dynamic"> You must type between 4 to 50 Characters in the name field </asp:CustomValidator> This statement creates a validation control CustomValidator for Name field. ControlToValidate property define that which control will be validate. Here this property set to "TextBox1" i.e. TextBox of Name field. OnServerValidate property Specifies the name of the server-side validation function ('NameCharacterCount' function) to be executed.
  • 43. 43 <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ValidationExpression="^([a-zA-z s]{0,500})$" ControlToValidate="TextBox1" SetFocusOnError="True" ErrorMessage="Only alphabets are allowed" Display="Dynamic"></asp:RegularExpressionValidator> .aspx Code Explanation-2 This statement creates a validation control RegularExpressionValidator for Name field. ValidationExpression property Specifies the expression used to validate input control . ErrorMessage property set the text to display the error message, when validation fails. ValidationExpression="^([a-zA-z s]{0,500})$" '[a-zA-zs]' part of the string define that the validate control takes only upper case or lower case English alphabet. '{0,500}' part of the string define that the validate control takes minimum '0' character and maximum '500' characters.
  • 44. 44 <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="DropDownList1" Display="Dynamic" ErrorMessage="This is a required field" SetFocusOnError="True" InitialValue="--Select--"></asp:RequiredFieldValidator> .aspx Code Explanation-3 This statement creates a validation control RequiredFieldValidator, which makes the Sex field as required field. SetFocusOnError property set the focus of the cursor on validating control, when validation fails. InitialValue property set the initial value of the control which is treated as null value by RequiredFieldValidator control.
  • 45. 45 .aspx Code Explanation-4 <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="TextBox2" MaximumValue="100" MinimumValue="10" SetFocusOnError="True" Type="Integer" Display="Dynamic"> Only the age value between 10 to 100 is permitted</asp:RangeValidator> This statement creates a validation control RangeValidator for Age field. MaximumValue property set the maximum input value for the validating control. MinimumValue property set the minimum input value for the validating control. Type property set the input type for the validating control.
  • 46. 46 <asp:CompareValidator ID="CompareValidator2" runat="server" ControlToCompare="TextBox4" ControlToValidate="TextBox5" SetFocusOnError="True" Display="Dynamic"> Both email addresses should be same </asp:CompareValidator> .aspx Code Explanation-5 <asp:CustomValidator ID="CustomValidator2" runat="server" OnServerValidate="CustomValidator2_ServerValidate" ControlToValidate="TextBox5" SetFocusOnError="True" Display="Dynamic"> You must type between 10 to 300 Characters in the FeedBack field</asp:CustomValidator> This statement creates a validation control CompareValidator, which Compare the value of validating control with specified control ControlToCompare property The ID of the control to compare with. This statement creates a validation control CustomValidator for Feed Back field. OnServerValidate property Specifies the name of the server-side validation function ('CustomValidator2_ServerValidate' function) to be executed.
  • 47. 47 If Page.IsValid = True Then Label1.Text = TextBox1.Text Label2.Text = DropDownList1.SelectedItem.Text Label3.Text = TextBox2.Text Label4.Text = TextBox3.Text Label5.Text = TextBox5.Text Panel1.Visible = True End If Server Side Code Explanation-1 These statements assign the TEXT property of Labels. Page.IsValid property is used to check whether a page is valid or not on button1 (Submit button) click event. These statements reset the page on Button2 (Reset button) click event. TextBox1.Text = "" DropDownList1.SelectedIndex = 2 TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" Panel1.Visible = False Label1.Text = "" Label2.Text = "" Label3.Text = "" Label4.Text = "" Label5.Text = ""
  • 48. 48 Server Side Code Explanation-2 args.Value.Length count the no. of characters in argument. If (args.Value.Length < 4 Or args.Value.Length > 50) Then args.IsValid = False Else args.IsValid = True End If If (args.Value.Length < 10 Or args.Value.Length > 300) Then args.IsValid = False Else args.IsValid = True End If
  • 49. 49 Modification Trials -1 Set the Display property equal to Static for all validation controls and run code. Watch the effect. Try to use RequiredFieldValidator validation control with EmailID field. Run and watch the effect. Try to change the ForeColor property of RangeValidator control Red to Blue. Run and watch the effect.
  • 50. 50 Modification Trials-2 Remove CustomValidator control and it's .aspx.vb code from Name field and change property ValidationExpression="^([a-zA-z s]{0,500})$" to ValidationExpression="^([a-zA-z s]{4,50})$" of RegularExpressionValidator control. Run and watch that when you will enter less then 4 characters or more then 50 characters, it will display "Only alphabets are allowed" error message. Try to increase the no. of characters limit of FeedBack field from 300 to 500.
  • 51. 51 Error Trials  Change ValidationExpression property from "^([a-zA-z s]{0,500})$" to "^([a-zA-z s])$" of RegularExpressionValidator control. See that when you gives any input, Validation controls of Name field produce an error message.
  • 52. 52 Error Trials-2  Re-store the original code and change ValidationExpression property from "^([a-zA-z s]{0,500})$" to "^([a-zA-z s]{4,50})$" of RegularExpressionValidator control of Name field. See that when you gives invalid input in Name field, it produce same error message i.e.
  • 53. 53 For further assistance take the help of your instructor or Internet. Practice Exercise Create a project for Daily Sales Entry Form, which have 5 fields namely Item ID, Item Price, Sales Quantity, Sales By, Sales Price. Program Should be calculate Sales Price Formula for Sales Price Calculation Sales Price = Item Price X Sales Quantity Instructions Item ID must be a Required Field. Item Price must be a 5 digits number Sales Quantity must be a required field Sales By field should be accept 3 to 40 alphabets only. User cannot enter any value in Sales Price field (Set ‘Enabled’ property of TextBox Control).
  • 54. 54 Design View of Practice Exercise Design View of Practice Exercise
  • 55. 55 Learning Summary Review Use of ASP:CustomValidator Use of ASP:RegularExpressionValidator Use of ASP:RequiredFieldValidator Use of ASP:RangeValidator Use of ASP:CompareValidator Use of Panel
  • 56. 56 Bibliography  ASP:CustomValidator: http://msdn.microsoft.com/en- us/library/9eee01cx(v=VS.71).aspx  ASP:RegularExpressionValidator: http://msdn.microsoft.com/en- us/library/eahwtc9e(v=VS.71).aspx  ASP:RequiredFieldValidator: http://msdn.microsoft.com/en- us/library/5hbw267h(v=VS.71).aspx  ASP:RangeValidator: http://msdn.microsoft.com/en- us/library/f70d09xt(v=VS.71).aspx  ASP:CompareValidator: http://msdn.microsoft.com/en- us/library/db330ayw(v=VS.71).aspx
  • 57. 57 Ask and guide me at sunmitraeducation@gmail.com Share this information with as many people as possible. Keep visiting www.sunmitra.com for programme updates.