4 Replies - 2692 Views - Last Post: 22 December 2008 - 09:22 PM Rate Topic: -----

#1 oasisjoel   User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 274
  • Joined: 11-September 08

How to make an if statement in ASP

Post icon  Posted 22 December 2008 - 08:48 PM

How can I use if statement in ASP? im new in asp..
if (System.Web.UI.WebControls.tex =! "Test") 
			{
			System.Web.UI.WebControls.TextBox = "tetewe";

			}

		}



im trying this one and it doesn't work.. T_T

This post has been edited by oasisjoel: 22 December 2008 - 08:49 PM

Is This A Good Question/Topic? 0
  • +

Replies To: How to make an if statement in ASP

#2 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6644
  • View blog
  • Posts: 30,937
  • Joined: 10-May 07

Re: How to make an if statement in ASP

Posted 22 December 2008 - 08:57 PM

** Renamed title to be descriptive of the problem **

if (System.Web.UI.WebControls.text =! "Test") {  // 1 open
	System.Web.UI.WebControls.TextBox = "tetewe";
} // one close



Your text was incorrect (System.Web.UI.WebControls.text), you had System.Web.UI.WebControls.tex

& you had two closing brackets, you only need as many as you open.
Was This Post Helpful? 0
  • +
  • -

#3 oasisjoel   User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 274
  • Joined: 11-September 08

Re: How to make an if statement in ASP

Posted 22 December 2008 - 09:00 PM

btw the name of my textbox is Textbox1. How can I compare the text inside it and change it once the button is clicked
Was This Post Helpful? 0
  • +
  • -

#4 PsychoCoder   User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1659
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: How to make an if statement in ASP

Posted 22 December 2008 - 09:07 PM

Do something like this (it works the same way it does with a Windows application

if (Textbox1.Text == "SomeString")
{
    Textbox1.Text = "SomeOtherString";
}


Was This Post Helpful? 0
  • +
  • -

#5 oasisjoel   User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 274
  • Joined: 11-September 08

Re: How to make an if statement in ASP

Posted 22 December 2008 - 09:22 PM

I didn't notice that its case sensitive that's why the intelesense doesn't show up..

thanks though
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1