Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Validate at Least One TextBox in ASP.NET
WhatsApp
Mukesh Kumar
Nov 26
2015
2.1
k
0
0
<asp:TextBox ID=
"txtHomePhone"
runat=
"server"
></asp:TextBox>
<asp:CustomValidator ID=
"cvHomePhone"
runat=
"server"
ErrorMessage=
"*"
ClientValidationFunction=
"Validate"
ControlToValidate=
"txtHomePhone"
ValidateEmptyText=
"true"
></asp:CustomValidator>
<asp:TextBox ID=
"txtWorkPhone"
runat=
"server"
></asp:TextBox>
<asp:CustomValidator ID=
"cvWorkPhone"
runat=
"server"
ErrorMessage=
"*"
ClientValidationFunction=
"Validate"
ControlToValidate=
"txtWorkPhone"
ValidateEmptyText=
"true"
></asp:CustomValidator>
<asp:TextBox ID=
"txtMobilePhone"
runat=
"server"
></asp:TextBox>
<asp:CustomValidator ID=
"cvMobilePhone"
runat=
"server"
ErrorMessage=
"*"
ClientValidationFunction=
"Validate"
ControlToValidate=
"txtMobilePhone"
ValidateEmptyText=
"true"
></asp:CustomValidator>
<script language=
"javascript"
>
function Validate(sender, args)
{
args.IsValid =
false
;
if
(args.Value !=
""
)
{
args.IsValid =
true
;
}
}
</script>
Asp.Net
validate textbox
Up Next
Validate at Least One TextBox in ASP.NET