Wrox Programmer Forums
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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......


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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.