TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Validate at Least One TextBox in ASP.NET
Mukesh Kumar
Nov 26
2015
Code
2
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
<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