Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 10th, 2007, 05:16 AM
Friend of Wrox
 
Join Date: Aug 2006
Location: Bangalore, Karnataka, India.
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default 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......
__________________
thanks......
  #2 (permalink)  
Old October 10th, 2007, 05:27 AM
Friend of Wrox
Points: 1,935, Level: 17
Points: 1,935, Level: 17 Points: 1,935, Level: 17 Points: 1,935, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: United Kingdom
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

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

Regards
Mike
  #3 (permalink)  
Old October 10th, 2007, 07:39 AM
Friend of Wrox
 
Join Date: Aug 2006
Location: Bangalore, Karnataka, India.
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

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......
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
List Box Text problem balesh ASP.NET 1.0 and 1.1 Professional 1 August 31st, 2006 07:05 AM
Don;t diplay text box if it is empty or null abdul_wasie Classic ASP Databases 5 May 20th, 2005 11:49 PM
text box problem crmpicco HTML Code Clinic 2 January 24th, 2005 06:18 AM
How to insert default value if text box is empty akc Javascript How-To 2 November 7th, 2003 11:55 AM



All times are GMT -4. The time now is 10:16 PM.


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