p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Professional (http://p2p.wrox.com/forumdisplay.php?f=215)
-   -   text box empty problem (http://p2p.wrox.com/showthread.php?t=62785)

MunishBhatia October 10th, 2007 05:16 AM

text box empty problem
 
hello

i am using gridview and in Rowupdating event using following code:

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)

{

objCallerListUserMaster.PhoneOne = (((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtPhoneOne")).Text).ToString();

string FinalPhoneNumber1 = "";

if ((objCallerListUserMaster.PhoneOne != "") || (objCallerListUserMaster.PhoneOne != null))

{

Do something.

}

else

{

lblValidUpdateNumber.Visible = true;

lblValidUpdateNumber.Text = "Please enter valid phone number or numbers in update. please try again.";

}

My problem is even textbox is empty and i did not enter any thing, it bypass my condition and execute "Do Something"

objCallerListUserMaster.PhoneOne shows ''''' in it but in visualizer it is empty please help


thanks......

mike_remember October 10th, 2007 05:27 AM

You have used OR (||) condition, use AND (&&) condition...

Regards
Mike

MunishBhatia October 10th, 2007 07:39 AM

well i was using or condition in it just to satisfy that it must not enter into code if it donot have phone number.
i solved my problem by writing following code

  if (!string.IsNullOrEmpty(objCallerListUserMaster.Pho neThree))

thanks......


All times are GMT -4. The time now is 06:01 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.