View Single Post
  #2 (permalink)  
Old August 21st, 2014, 11:44 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

Hi there,

1. On page 7, step 7, I put % in the line to display the date/time. Why? If I delete them, the code still appears to work. On page 50, virtually the same code is used, but the % isn't there. Why?
The % symbol makes it code that runs at the server. If you remove it, the code stops working. <%= => is a shortcut for Response.Write; e.g. it write to the final HTML directly where it's used. The code on page 50 is defined in the code behind and runs at the server. It's in code, not in markup and thus doesn't write to the response directly, but assigns the value to some other control.

2. On page 14, at the bottom, I am told most ASP.NET tags begin with asp: prefix. Why? What purpose does the "asp" serve and is it always necessary?
ASP.NET needs some way to identify arbitrary code and notice these are server controls that need to be processed. The Microsoft team chose asp for obvious reasons (since the framework is called ASP.NET). For your own controls you pick almost anything.

3. I frequently see runat="server" inserted into the code. Does this mean that the code runs on the server, like suggested on page 15, second paragraph? Can I delete it, or put something else in? What else can I put in?
Runat="server" is the only available option. It makes the control run at the server and is required to operate.
4. On page 164, step 4, the number entered on the calculator is converted to a Double. I'm guessing this is to allow for extremely large numbers AND to allow for slightly faster computation?
And to support fractional numbers.


Imar Spaanjaars
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!

Last edited by Imar; August 21st, 2014 at 11:47 AM..
Reply With Quote