|
 |
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
|
 |
|
|
 |

August 21st, 2014, 11:31 AM
|
Registered User
|
|
Join Date: Aug 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
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
|

August 21st, 2014, 11:44 AM
|
 |
Wrox Author
Points: 72,055, Level: 100 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
|
|
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
Last edited by Imar; August 21st, 2014 at 11:47 AM..
|

August 21st, 2014, 03:06 PM
|
Registered User
|
|
Join Date: Aug 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
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..
|

August 21st, 2014, 04:05 PM
|
 |
Wrox Author
Points: 72,055, Level: 100 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
|
|
Yep, correct. You can find more about comments here: http://msdn.microsoft.com/en-us/libr...vs.100%29.aspx
Cheers,
Imar
|

August 22nd, 2014, 11:51 AM
|
Registered User
|
|
Join Date: Aug 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
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?
|

August 24th, 2014, 07:01 AM
|
 |
Wrox Author
Points: 72,055, Level: 100 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
|
|
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
|
Thread Tools |
Search this Thread |
|
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |
All times are GMT -4. The time now is 11:53 PM.
|