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
Abhijit Patil
NA
3.8k
1.6m
how to identify the empty textbox in asp.net
Apr 11 2015 7:07 AM
hi folks,
In asp.net i bind all textbox to textchange event and get the sender value of textbox and do my operation.
textchange event is work fine .but problem is that when my textbox is empty and i pressed enter then the event is not fire.
how to solve my problem.
my code snippest as below
protected void txtName_TextChanged(object sender, EventArgs e)
{
TextBox tb = sender as TextBox;
if (tb.ID == "TextBox1")
{
if (tb.Text == string.Empty)
{
Label1.Text = "Please enter input";
}
else if (TextBox1.Text == "001")
{
Label1.Text = "user is valid";
TextBox2.Focus();
}
else
{
Label1.Text = "user is not valid";
TextBox2.Focus();
}
}
else if (tb.ID == "TextBox2")
{
if (tb.Text == string.Empty)
{
Label1.Text = "Please enter input";
}
else
{
Label1.Text = TextBox1.Text;
}
}
Reply
Answers (
2
)
Gridview
Ap.Netin Lnux