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
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Murali Kris
1.5k
254
48k
TextBox validation with CustomValidator Error Msg
Aug 1 2019 4:45 AM
Hi all,
i am sure its very small but i tried a lot since not a expert in c# validations
kindly help me here for validation.
1. I have two textboxs one for username, another for just email
2. i have to use CustomValidator for textbox.
the movment when cursour goes to next text box with blank(if textbox1 isempty)from first, then i want to display customvalidator error message.
Yes we have RequiredFiled validator option, it shows the msg when press the submit buttion only but not when cursor moves to next textbox.
how to display errormsg when cursor moves to next textbox like txtbox1 should not empty.
from UI.ASPX Source
<asp:CustomValidator ID="CustomValidator1" runat="server"
ErrorMessage=""
Display="Dynamic"
forecolor="Red"
OnServerValidate="CustomValidator1_ServerValidate"
ControlToValidate="TxtUserName"
ValidateEmptyText="True"></asp:CustomValidator>
From UI.ASPX.cs code
protected void CustomValidator1_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
{
if (args.Value == "")
{
CustomValidator1.ErrorMessage = "error from custom";
args.IsValid = false;
}
}
Kindly help me with code for the above requirement.
Reply
Answers (
2
)
Unable to connect remote server - web service error
click in the below java script code is not working.