SlideShare a Scribd company logo
Chapter 3
Validation
Controls
ValidationControl ហ ោសូហនឿន 1
Introduction
 Used to validate User-Input in an input control.
 The page validation is performed when a
Button, ImageButton, or Link control is clicked.
 Setting CauseValidation to False is to cancel
Validation.
ValidationControlហ ោសូហនឿន
2
Types of Validation Controls
 There are 6 types of Validation Controls
 RequiredFiledValidator Control
 RangeValidator Control
 RegularExpressionValidator Control
 CompareValidator Control
 CustomValidator Control
 ValidationSummary Control
ValidationControlហ ោសូហនឿន
3
RequiredFieldValidator
 To make sure that has entered the required data in
the input control(TextBox).
<asp:RequiredFieldValidator runat=server ID=…
ControlToValidate=… ErrorMessage=“….">
</asp:RequiredFieldValidator>
ValidationControlហ ោសូហនឿន
4
RequiredFieldValidator
 See the example:
<body>
<form id="form1" runat="server">
<asp:TextBox ID=fName runat=server> </asp:TextBox>
<asp:RequiredFieldValidator runat=server ID=fNameVal
ControlToValidate=fName ErrorMessage="Please Enter the First
Name"></asp:RequiredFieldValidator>
<asp:Button ID=Submit runat=server Text=Submit />
</form>
</body>
ValidationControlហ ោសូហនឿន
5
RangeValidator
 To check that the values input is what in the
specified range of values.
 There are some important properties:
 ControlToValidate
 MinimumValue
 MaximumValue
 Type
<asp:RangeValidator runat=server ID=… ControlToValidate=… Type=…
MinimumValue=… MaximumValue=… ErrorMessage=“…">
</asp:RangeValidator>
ValidationControlហ ោសូហនឿន
6
RangeValidator
 See the Example:
<body>
<form id="form1" runat="server">
<asp:TextBox ID=fName runat=server> </asp:TextBox>
<asp:RangeValidator runat=server ControlToValidate=fName MinimumValue="A"
MaximumValue="Z" Type=String ID=fNameVal ErrorMessage="Capital Only"
CultureInvariantValues="True"></asp:RangeValidator> <br />
<asp:Button ID=Submit runat=server Text=Submit />
</form>
</body>
ValidationControlហ ោសូហនឿន
7
RegularExpspressionValidator
 To make sure the data input into the input box
match the specified the format.
 It is made up of text with an embedded code
started with a backslash ().
 The property ValidateExpression is used the
format the data input.
ValidationControlហ ោសូហនឿន
8
RegularExpspressionValidator
 To set the word boundary use
 b ….. b
 [Range of Input]
Example you can set the format for letter input a-z and A-Z as below:
b[A-Za-z]+b
<asp:TextBox ID=fName runat=server ></asp:TextBox>
<asp:RegularExpressionValidator runat=server ID=fNameVal ControlToValidate=fName
ValidationExpression="b[A-Z]+b" ErrorMessage="Enter the Letter [a-z, A-Z]
only"></asp:RegularExpressionValidator>
ValidationControlហ ោសូហនឿន
9
RegularExpspressionValidator
 There are some more important forms of the
expression format.
w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*
[0-9]{3}-[0-9]{6}
[0-9]{3}-[0-9]{6,7}
ValidationControlហ ោសូហនឿន
10
CompareValidator
 It is used to compare the value entered by a user
into an input box to another.
 Some properties used with the CompareValidator
are:
 ControlToCompare
 Operator
 ValueToCompare
 ControlToValidate
 Type
 ErrorMessage
ValidationControlហ ោសូហនឿន
11
CompareValidator
 The Operator property has the following value:
 Equal
 NotEqual
 GreaterThan
 GreaterThanEqual
 LessThan
 LessThanEqual
 DataTypeCheck
ValidationControlហ ោសូហនឿន
12
CompareValidator
 See the example:
<body>
<form id="form1" runat="server">
User Name: <asp:TextBox ID=txtuser runat=server > </asp:TextBox>
<asp:CompareValidator runat=server ControlToValidate=txtuser
ValueToCompare="sonoeun" ErrorMessage="Invalid User Name">
</asp:CompareValidator> <br />
<asp:Button runat=server ID=bntSubmit Text=Submit />
</form>
</body>
ValidationControlហ ោសូហនឿន
13
CustomValidator
 To check that the data input matches the a given
condition or not.
 It is a powerful way to use the Validator controls
since you can write your own customization code.
 It uses the main properties and methods as below:
 ClientValidationFunction: To set the name of the custom
client-side script function used for Validation.
 ValidateEmptyText: To set a boolean value to make sure if
the empty text should be validated or not.
 ServerValidate : The method occurring when the validation
takes place on the server.
ValidationControlហ ោសូហនឿន
14
CustomValidator
 See the Example
<body>
<form id="form1" runat="server">
<script language=vbscript runat=server type="text/vbscript" >
Sub serverVal(ByVal source, ByVal objServer)
If (objServer.value = "ServerValidation") Then
objServer.IsValid = True
lbl.Text = "Subscription Successful"
Else
objServer.IsValid = False
lbl.Text = "Subscription Not Successful"
End If
End Sub
</script>
ValidationControlហ ោសូហនឿន
15
CustomValidator
 See the Example (cont.)
<asp:TextBox ID=ServerObj runat=server ></asp:TextBox>
<asp:CustomValidator ID=ServerObjVal runat=server
OnServerValidate="serverVal" ControlToValidate=ServerObj
ErrorMessage="Subscription NOT Accepted">
</asp:CustomValidator>
<br />
<asp:Button runat=server ID=submitServer Text=Submit />
<br />
<asp:label ID=lbl runat=server ></asp:label>
</form>
</body>
ValidationControlហ ោសូហនឿន
16
ValidationSummary
 It collects all validation control error messages for
centralized display.
 It can be displayed as a list, a bullet list, a single
paragraph depending on the DisplayMode
 Specifying the summary display by setting
ShowSummary and ShowMessageBox
properties.
ValidationControlហ ោសូហនឿន
17
ValidationSummary
 Some properties you should know when you use
validationSummary are:
 DisplayedMode
 EnableClientScript
 ForeColor
 HeaderText
 ShowMessageBox
 ShowSummary
ValidationControlហ ោសូហនឿន
18
ValidationSummary
 See The Example:
<body>
<form id="form1" runat="server">
First Name:
<asp:TextBox ID=fName runat=server ></asp:TextBox>
<asp:RequiredFieldValidator runat=server ID=RefNameVal
ControlToValidate=fName ErrorMessage="First Name
Needed"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator runat=server ID=EprfNameVal
ControlToValidate=fName ValidationExpression="b[A-z]+b"
ErrorMessage="No Number Permited">
</asp:RegularExpressionValidator>
<br />
Last Name:
<asp:TextBox ID=lName runat=server></asp:TextBox>
ValidationControlហ ោសូហនឿន
19
ValidationSummary
 See The Example:
<asp:RequiredFieldValidator runat=server ID=RelNameVal
ControlToValidate=lName ErrorMessage="Last Name
Needed"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator runat=server ID=ExplNameVal
ValidationExpression="b[A-Z]+b" ControlToValidate=lName
ErrorMessage="Capital Letter Only">
</asp:RegularExpressionValidator> <br/>
<asp:Button runat=server ID=btnSubmit Text=Submit />
<br />
<asp:ValidationSummary ID=valSummary
ShowMessageBox=true runat=server />
</form>
</body>
ValidationControlហ ោសូហនឿន
20
ValidationGroup
 It a property of Validator controls.
 Setting ValidationGroup, it validates only the
validation controls within the specified group when
the control is post back to the server.
 It is used to assign a validation control to a
validation group.
ValidationControlហ ោសូហនឿន
21
ValidationGroup
 Example
ValidationControlហ ោសូហនឿន
22
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" Runat="server" ValidationGroup="First">
</asp:TextBox>
<asp:TextBox ID="TextBox2" Runat="server" ValidationGroup="First">
</asp:TextBox><br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" Runat="server"
ValidationGroup="First" ErrorMessage="TextBox1 should not be blank"
ControlToValidate="TextBox1"> </asp:RequiredFieldValidator>
<asp:Button ID="Submit1" Runat="server" ValidationGroup="First"
Text="Submit 1" />
<br /> <br />
ValidationGroup
ValidationControlហ ោសូហនឿន
23
<asp:TextBox ID="TextBox3" Runat="server" ValidationGroup="Second">
</asp:TextBox>
<asp:TextBox ID="TextBox4" Runat="server" ValidationGroup="Second">
</asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" Runat="server"
ErrorMessage=" TextBox3 should not be blank"
ControlToValidate="TextBox3" ValidationGroup="Second">
</asp:RequiredFieldValidator>
<asp:Button ID="Submit2" Runat="server" ValidationGroup="Second"
Text="Submit 2" />
</div>
</form>
</body>
End
ValidationControl ហ ោសូហនឿន 24

More Related Content

Similar to Chapter 3 (validation control) (9)

PPTX
Validation in asp.net
Sireesh K
 
PPTX
Validation Controls in asp.net
Deep Patel
 
PDF
validation-controls.pdf ioue8n uoh souu o3i
CoRRexGaMing
 
PPTX
vnd.openxmlformats-officedocument.presentationml.presentation&rendition=1.pptx
YamunaS38
 
PPTX
Asp.NET Validation controls
Guddu gupta
 
PPTX
Chapter 9
application developer
 
PPTX
Validation controls in asp
Shishir Jain
 
PPTX
Asp.net validation
Paneliya Prince
 
PPTX
validation of aap.net
Pratiksha Srivastava
 
Validation in asp.net
Sireesh K
 
Validation Controls in asp.net
Deep Patel
 
validation-controls.pdf ioue8n uoh souu o3i
CoRRexGaMing
 
vnd.openxmlformats-officedocument.presentationml.presentation&rendition=1.pptx
YamunaS38
 
Asp.NET Validation controls
Guddu gupta
 
Validation controls in asp
Shishir Jain
 
Asp.net validation
Paneliya Prince
 
validation of aap.net
Pratiksha Srivastava
 

More from let's go to study (20)

PPTX
Rs instructor ppt_chapter11_final
let's go to study
 
PDF
Before beginning
let's go to study
 
PDF
Chapter 8 (security)
let's go to study
 
PDF
Chapter 7 (ado.net)
let's go to study
 
PDF
Chapter 6 (data binding)
let's go to study
 
PDF
Chapter 5 (master page)
let's go to study
 
PDF
Chapter 4 (navigater)
let's go to study
 
PDF
Chapter 2 (web servercontrol)
let's go to study
 
PDF
Chapter 1 (asp.net over view)
let's go to study
 
PDF
Before beginning
let's go to study
 
PPT
Sadchap04
let's go to study
 
PPT
Sadchap03
let's go to study
 
PPT
Sadchap02
let's go to study
 
PPT
Sadchap01
let's go to study
 
PPTX
database design process
let's go to study
 
PPTX
009 sql server management studio
let's go to study
 
PPTX
007 sql server-installation
let's go to study
 
PPT
Chapter 2-html-tage
let's go to study
 
PDF
Chapter 0 before you start
let's go to study
 
Rs instructor ppt_chapter11_final
let's go to study
 
Before beginning
let's go to study
 
Chapter 8 (security)
let's go to study
 
Chapter 7 (ado.net)
let's go to study
 
Chapter 6 (data binding)
let's go to study
 
Chapter 5 (master page)
let's go to study
 
Chapter 4 (navigater)
let's go to study
 
Chapter 2 (web servercontrol)
let's go to study
 
Chapter 1 (asp.net over view)
let's go to study
 
Before beginning
let's go to study
 
database design process
let's go to study
 
009 sql server management studio
let's go to study
 
007 sql server-installation
let's go to study
 
Chapter 2-html-tage
let's go to study
 
Chapter 0 before you start
let's go to study
 
Ad

Recently uploaded (20)

PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PDF
SSHS-2025-PKLP_Quarter-1-Dr.-Kerby-Alvarez.pdf
AishahSangcopan1
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PDF
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PDF
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
PPTX
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PPTX
Soil and agriculture microbiology .pptx
Keerthana Ramesh
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
SSHS-2025-PKLP_Quarter-1-Dr.-Kerby-Alvarez.pdf
AishahSangcopan1
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
community health nursing question paper 2.pdf
Prince kumar
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
Soil and agriculture microbiology .pptx
Keerthana Ramesh
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Ad

Chapter 3 (validation control)

  • 2. Introduction  Used to validate User-Input in an input control.  The page validation is performed when a Button, ImageButton, or Link control is clicked.  Setting CauseValidation to False is to cancel Validation. ValidationControlហ ោសូហនឿន 2
  • 3. Types of Validation Controls  There are 6 types of Validation Controls  RequiredFiledValidator Control  RangeValidator Control  RegularExpressionValidator Control  CompareValidator Control  CustomValidator Control  ValidationSummary Control ValidationControlហ ោសូហនឿន 3
  • 4. RequiredFieldValidator  To make sure that has entered the required data in the input control(TextBox). <asp:RequiredFieldValidator runat=server ID=… ControlToValidate=… ErrorMessage=“…."> </asp:RequiredFieldValidator> ValidationControlហ ោសូហនឿន 4
  • 5. RequiredFieldValidator  See the example: <body> <form id="form1" runat="server"> <asp:TextBox ID=fName runat=server> </asp:TextBox> <asp:RequiredFieldValidator runat=server ID=fNameVal ControlToValidate=fName ErrorMessage="Please Enter the First Name"></asp:RequiredFieldValidator> <asp:Button ID=Submit runat=server Text=Submit /> </form> </body> ValidationControlហ ោសូហនឿន 5
  • 6. RangeValidator  To check that the values input is what in the specified range of values.  There are some important properties:  ControlToValidate  MinimumValue  MaximumValue  Type <asp:RangeValidator runat=server ID=… ControlToValidate=… Type=… MinimumValue=… MaximumValue=… ErrorMessage=“…"> </asp:RangeValidator> ValidationControlហ ោសូហនឿន 6
  • 7. RangeValidator  See the Example: <body> <form id="form1" runat="server"> <asp:TextBox ID=fName runat=server> </asp:TextBox> <asp:RangeValidator runat=server ControlToValidate=fName MinimumValue="A" MaximumValue="Z" Type=String ID=fNameVal ErrorMessage="Capital Only" CultureInvariantValues="True"></asp:RangeValidator> <br /> <asp:Button ID=Submit runat=server Text=Submit /> </form> </body> ValidationControlហ ោសូហនឿន 7
  • 8. RegularExpspressionValidator  To make sure the data input into the input box match the specified the format.  It is made up of text with an embedded code started with a backslash ().  The property ValidateExpression is used the format the data input. ValidationControlហ ោសូហនឿន 8
  • 9. RegularExpspressionValidator  To set the word boundary use  b ….. b  [Range of Input] Example you can set the format for letter input a-z and A-Z as below: b[A-Za-z]+b <asp:TextBox ID=fName runat=server ></asp:TextBox> <asp:RegularExpressionValidator runat=server ID=fNameVal ControlToValidate=fName ValidationExpression="b[A-Z]+b" ErrorMessage="Enter the Letter [a-z, A-Z] only"></asp:RegularExpressionValidator> ValidationControlហ ោសូហនឿន 9
  • 10. RegularExpspressionValidator  There are some more important forms of the expression format. w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)* [0-9]{3}-[0-9]{6} [0-9]{3}-[0-9]{6,7} ValidationControlហ ោសូហនឿន 10
  • 11. CompareValidator  It is used to compare the value entered by a user into an input box to another.  Some properties used with the CompareValidator are:  ControlToCompare  Operator  ValueToCompare  ControlToValidate  Type  ErrorMessage ValidationControlហ ោសូហនឿន 11
  • 12. CompareValidator  The Operator property has the following value:  Equal  NotEqual  GreaterThan  GreaterThanEqual  LessThan  LessThanEqual  DataTypeCheck ValidationControlហ ោសូហនឿន 12
  • 13. CompareValidator  See the example: <body> <form id="form1" runat="server"> User Name: <asp:TextBox ID=txtuser runat=server > </asp:TextBox> <asp:CompareValidator runat=server ControlToValidate=txtuser ValueToCompare="sonoeun" ErrorMessage="Invalid User Name"> </asp:CompareValidator> <br /> <asp:Button runat=server ID=bntSubmit Text=Submit /> </form> </body> ValidationControlហ ោសូហនឿន 13
  • 14. CustomValidator  To check that the data input matches the a given condition or not.  It is a powerful way to use the Validator controls since you can write your own customization code.  It uses the main properties and methods as below:  ClientValidationFunction: To set the name of the custom client-side script function used for Validation.  ValidateEmptyText: To set a boolean value to make sure if the empty text should be validated or not.  ServerValidate : The method occurring when the validation takes place on the server. ValidationControlហ ោសូហនឿន 14
  • 15. CustomValidator  See the Example <body> <form id="form1" runat="server"> <script language=vbscript runat=server type="text/vbscript" > Sub serverVal(ByVal source, ByVal objServer) If (objServer.value = "ServerValidation") Then objServer.IsValid = True lbl.Text = "Subscription Successful" Else objServer.IsValid = False lbl.Text = "Subscription Not Successful" End If End Sub </script> ValidationControlហ ោសូហនឿន 15
  • 16. CustomValidator  See the Example (cont.) <asp:TextBox ID=ServerObj runat=server ></asp:TextBox> <asp:CustomValidator ID=ServerObjVal runat=server OnServerValidate="serverVal" ControlToValidate=ServerObj ErrorMessage="Subscription NOT Accepted"> </asp:CustomValidator> <br /> <asp:Button runat=server ID=submitServer Text=Submit /> <br /> <asp:label ID=lbl runat=server ></asp:label> </form> </body> ValidationControlហ ោសូហនឿន 16
  • 17. ValidationSummary  It collects all validation control error messages for centralized display.  It can be displayed as a list, a bullet list, a single paragraph depending on the DisplayMode  Specifying the summary display by setting ShowSummary and ShowMessageBox properties. ValidationControlហ ោសូហនឿន 17
  • 18. ValidationSummary  Some properties you should know when you use validationSummary are:  DisplayedMode  EnableClientScript  ForeColor  HeaderText  ShowMessageBox  ShowSummary ValidationControlហ ោសូហនឿន 18
  • 19. ValidationSummary  See The Example: <body> <form id="form1" runat="server"> First Name: <asp:TextBox ID=fName runat=server ></asp:TextBox> <asp:RequiredFieldValidator runat=server ID=RefNameVal ControlToValidate=fName ErrorMessage="First Name Needed"></asp:RequiredFieldValidator> <asp:RegularExpressionValidator runat=server ID=EprfNameVal ControlToValidate=fName ValidationExpression="b[A-z]+b" ErrorMessage="No Number Permited"> </asp:RegularExpressionValidator> <br /> Last Name: <asp:TextBox ID=lName runat=server></asp:TextBox> ValidationControlហ ោសូហនឿន 19
  • 20. ValidationSummary  See The Example: <asp:RequiredFieldValidator runat=server ID=RelNameVal ControlToValidate=lName ErrorMessage="Last Name Needed"></asp:RequiredFieldValidator> <asp:RegularExpressionValidator runat=server ID=ExplNameVal ValidationExpression="b[A-Z]+b" ControlToValidate=lName ErrorMessage="Capital Letter Only"> </asp:RegularExpressionValidator> <br/> <asp:Button runat=server ID=btnSubmit Text=Submit /> <br /> <asp:ValidationSummary ID=valSummary ShowMessageBox=true runat=server /> </form> </body> ValidationControlហ ោសូហនឿន 20
  • 21. ValidationGroup  It a property of Validator controls.  Setting ValidationGroup, it validates only the validation controls within the specified group when the control is post back to the server.  It is used to assign a validation control to a validation group. ValidationControlហ ោសូហនឿន 21
  • 22. ValidationGroup  Example ValidationControlហ ោសូហនឿន 22 <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" Runat="server" ValidationGroup="First"> </asp:TextBox> <asp:TextBox ID="TextBox2" Runat="server" ValidationGroup="First"> </asp:TextBox><br /> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" Runat="server" ValidationGroup="First" ErrorMessage="TextBox1 should not be blank" ControlToValidate="TextBox1"> </asp:RequiredFieldValidator> <asp:Button ID="Submit1" Runat="server" ValidationGroup="First" Text="Submit 1" /> <br /> <br />
  • 23. ValidationGroup ValidationControlហ ោសូហនឿន 23 <asp:TextBox ID="TextBox3" Runat="server" ValidationGroup="Second"> </asp:TextBox> <asp:TextBox ID="TextBox4" Runat="server" ValidationGroup="Second"> </asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" Runat="server" ErrorMessage=" TextBox3 should not be blank" ControlToValidate="TextBox3" ValidationGroup="Second"> </asp:RequiredFieldValidator> <asp:Button ID="Submit2" Runat="server" ValidationGroup="Second" Text="Submit 2" /> </div> </form> </body>