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
Priya M
NA
42
11.5k
If Statment
Feb 3 2016 7:15 AM
hello
i want to run this code,where all fields is not null then Query will be Executed,if not then message will be displayed
private bool IsValidationSuccess()
{
try
{
if (string.IsNullOrEmpty(txtCompanyName.Text.Trim())
&& string.IsNullOrEmpty(txtCompanyAddress1.Text) &&string.IsNullOrEmpty(txtPincode.Text.Trim())
&& cmbDistrict.SelectedIndex <=0 && cmbTaluka.SelectedIndex <=0)
{
return false;
}
else
{
return true ;
}
}
catch (SqlException ex)
{
throw ex;
}
//on button click
if (IsValidationSuccess())
{
AddCompanyDetails();
}
else
{
MessageBox.Show("Please fill Compulsary(*) field");
}
///////////////////////////////
error:when all field contain data it returns false,and message box is displayed .
Reply
Answers (
4
)
Plugin and Extension in C# .Net
Fire Timer Tick Event even when page is not loading