Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 August 21st, 2014, 11:31 AM
Registered User
 
Join Date: Aug 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Lot's of Questions

I have a lot of questions in regards to the book content. I don't just want to type the code and regurgitate what I read. I want to understand why I'm typing what I'm typing. That said...

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?

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?

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?

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?

I'm sure I'll come up with more. I am not just looking for answers. If someone can direct me to a place where I can find them, COOL! I just like learning exactly WHAT I'm typing and not just relying on the VWD GUI to do everything for me or just regurgitate some code because "that's what I was taught".

Thanks for the help!
Regards,
William
 
Old August 21st, 2014, 11:44 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Quote:
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.

Quote:
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.

Quote:
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.
Quote:
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.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
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..
 
Old August 21st, 2014, 03:06 PM
Registered User
 
Join Date: Aug 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks!

Another noob question.

Comments. I know that in VB they need to be preceded by a tick mark '. I've tried to insert comments in Markup, but they come out IN the screen. I did notice that I can put them in the "Code Behind" page, and the text turns green and doesn't interfere with the program. Is this normal, or am I doing something wrong in the Markup page?

Never mind. Figured it out. <%-- Comment --%>

The tick mark is for Code Behind only.

Last edited by Jhalad; August 21st, 2014 at 03:16 PM..
 
Old August 21st, 2014, 04:05 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yep, correct. You can find more about comments here: http://msdn.microsoft.com/en-us/libr...vs.100%29.aspx

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
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!
 
Old August 22nd, 2014, 11:51 AM
Registered User
 
Join Date: Aug 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Next question. Well, verification, actually

I'm going through Chapter 5, and as recommended, typing the code into a "Test Page". When I type of three VB.NET codes at the bottom of page 150 (making new Lists), the Button one turns light blue vs. dark blue. I'm guessing this is because Button is a control, like List is?
 
Old August 24th, 2014, 07:01 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,
Quote:
I'm guessing this is because Button is a control, like List is?
No, that's not it. int and bool turn dark blue because they are C# types; shortcuts for types in .NET. If you were to change int to Int32 (the corresponding .NET type) and bool to Boolean, they would turn light-blue as well.

BTW: List is not a control. It's a type that can be used anywhere in any .NET application and can hold objects of a specific type.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
.NET Interview Questions, C# Interview Questions, dotnetuncle .NET Framework 2.0 4 June 22nd, 2019 07:03 AM
To ask questions Mpandey BOOK: Ivor Horton's Beginning Visual C++ 2005 2 February 23rd, 2009 08:32 AM
Lot's of 'when' clauses ... asearle XSLT 0 October 17th, 2006 03:55 AM
C# questions zhenliu C# 1 April 15th, 2004 09:18 AM
questions anshul Javascript How-To 1 April 12th, 2004 07:29 AM





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