help with basic if then else (Full Version)

All Forums >> [Web Development] >> ASP, PHP, and Database



Message


furious_mango -> help with basic if then else (5/20/2009 23:43:55)

hi I'm a total noob with coding and expression web.
it's not my major and I haven't done any programming before.

Sitting in the lab at the moment and staring blankly at this question:

1. Create a new page called tutorial_form.aspx

2. Insert a new textbox and a button that asks a user to enter a number between 0 and 100.

3. Add code so that only during a postback if the user entered a number below 0 it outputs, “You are naughty, your number was below 0”, if the number was above 100 it outputs “Tsk Tsk. I told you to enter a number below 100”, otherwise it outputs “Thank you for following instructions. [the number] is between 0 and 100”.
Note: You will need to convert the input from a String to an Integer and you will need to nested IF statements!


Can someone help please?


edit: i know how to add the textbox and the button.

I'm just not sure about the coding:

what am i doing wrong here:

<script runat="server">

Sub Page_Load(ByVal sender as Object, ByVal E as EventArgs)

dim number as integer

If number <=0 Then
response.Write "You are naughty, your number was below 0"
else If number >=100 Then
response.Write "Tsk Tsk. i told you to enter a number below 100"
else
response.Write "Thank you for following instructions. (numberbox.Text) is between 0 and 100"
end If

end sub

</script>





swoosh -> RE: help with basic if then else (5/27/2009 16:29:32)

I believe your missing assigning the variable number to the actual textbox in your code

number = numberbox.text




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875