Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 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
 
Old June 12th, 2004, 11:27 PM
Authorized User
 
Join Date: Oct 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default asp.net test example

I attempted to try the example labled 'punctual.aspx' on page 36-37 of Beginning ASP.Net 1.1 with VB.Net 2003.
When I typed the code the result failed to run.
Instead I recieved an error message indicating "time had not been declared".
I rectified this by adding a textbox to the form.
The code ran partially but now there was no 'time' displayed.
The phrase "In WebServerLand... displays but the textbox is empty.
I added a button object to see what would happen if I put the code from the page_load event in the button_click sub.
This rectified the problem but left me a little perplexed.
Shouldn't the page_load event run the moment the page is displayed.
And if it is running (which it does:The page displays without the time),shouldn't the time function be invoked since it is within the page_load event ? Why did it take a button_click event to fix the problem.
Also why wasn't it explicitly stated in the book to add a textbox or label to the form. The picture on the corresponding page does not show a textbox or label object when the program is run. Why is this ?

 
Old June 13th, 2004, 05:36 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

Could you post any relevant code? I don't have the book.

Thanks,

Brian
 
Old June 13th, 2004, 10:15 PM
Authorized User
 
Join Date: Oct 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

STEP I)The example begins by having you create a file entitled punctual.aspx

The example uses Web Matrix as their Web Server. I use VS.Net with IIS.

STEP II)Describes putting file in a folder ch1. 'Not a big deal'

STEP III)Says to select the code tab and type code:
Sub Page_Load()
    time.text = Hour(Now) & ":" & Minute(Now) & ":" & Second(Now)
End Sub

STEP IV)Select the HTML tag and add the following between the <form> tags:
In WebServerLand the time is currently:
<asp:label id="time" runat="server" />

STEP V)Click on the arrow button to view the page from within Web Matrix.
Step 5 then has a display of the browser with the phrase
"In WebServerLand ... followed by the time 16:50:27"

The additional steps discuss viewing the page outside of WebMatrix.
This is a relatively simple example;nonetheless I got stumped.


 
Old June 14th, 2004, 07:25 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Quote:
quote:Originally posted by frresh
Also why wasn't it explicitly stated in the book to add a textbox or label to the form....
<asp:label id="time" runat="server" />
I have looked in the previous version of this book. I doubt that this example is going to be much different and I see the label object in the HTML. This is "time". On the screenshot of the resulting output you shouldn't see anything other than text. A label won't look any different (unless you change its style) than the surrounding text.

I don't see anything wrong with what you have. Can you post more (all perhaps given that this is a small example) of the code?
 
Old June 14th, 2004, 11:00 AM
Authorized User
 
Join Date: Oct 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In the example the screenshot displays the time. Why won't my code display time without resorting to the buttom_click event ?
It is only when I use the button_click sub that the actual time is displayed.Please explain.There is no more relevent code to present for this example.

 
Old June 14th, 2004, 11:02 AM
Authorized User
 
Join Date: Oct 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In the example the screenshot displays the time. Why won't my code display time without resorting to the button_click event ?
It is only when I use the button_click sub that the actual time is displayed.Please explain.There is no more relevant code to present for this example.

 
Old June 14th, 2004, 11:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Please copy and paste the entire actual code you have.

Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
 
Old June 14th, 2004, 01:00 PM
Authorized User
 
Join Date: Oct 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is a simple example of a dynamic web page.There are only two lines of code.Line 1 is illustrated in STEP3 and line 2 is on STEP4.
STEP 3 is part of the the code behind in the page_load Sub
STEP 4 is within the HTML code section as I am sure you will recognize.
The screen shot in the book displays the current time.My code will not display the time.It simply displays the phrase:

 In WebServerLand the time is currently:
 Why does my code fail to show the time ?

STEP I)The example begins by having you create a file entitled punctual.aspx

The example uses Web Matrix as their Web Server. I use VS.Net with IIS.

STEP II)Describes putting file in a folder ch1. 'Not a big deal'

STEP III)Says to select the code tab and type code:
Sub Page_Load()
    time.text = Hour(Now) & ":" & Minute(Now) & ":" & Second(Now)
End Sub

STEP IV)Select the HTML tag and add the following between the <form> tags:
In WebServerLand the time is currently:
<asp:label id="time" runat="server" />

STEP V)Click on the arrow button to view the page from within Web Matrix.
Step 5 then has a display of the browser with the phrase
"In WebServerLand ... followed by the time 16:50:27"

The additional steps discuss viewing the page outside of WebMatrix.
This is a relatively simple example;nonetheless I got stumped.




 
Old June 14th, 2004, 01:06 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Can you do anything else with ASP.NET?

Try Response.Write()ing, maybe?

Snib

<><
 
Old June 14th, 2004, 01:20 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Ok- I have the book.. I know what it says.. I want to see YOUR ACTUAL CODE. Not a rehash of what the book says.

Copy the WHOLE PAGE

Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee





Similar Threads
Thread Thread Starter Forum Replies Last Post
Create an online test using asp.net and C# Alaphat ASP.NET 2.0 Professional 3 April 14th, 2014 06:16 AM
What’s the .NET Way to test if Folder Exists? BrianWren Pro Visual Basic 2005 3 March 14th, 2007 08:35 AM
What’s the .NET Way to test if Folder Exists? BrianWren Visual Basic 2005 Basics 3 January 12th, 2007 07:32 PM
What’s the .NET Way to test if Folder Exists? BrianWren VB.NET 0 November 30th, 2006 02:46 PM
best way to test .NET source code woojtii .NET Framework 2.0 2 September 7th, 2006 07:39 PM





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