Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 31st, 2013, 12:13 PM
Registered User
Points: 21, Level: 1
Points: 21, Level: 1 Points: 21, Level: 1 Points: 21, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2013
Location: South West UK
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6 BasePage & Template Try It Out

Hi,

The text in my version of the book is updated and much of the errata provided in that section of this site is corrected but this chapter has a few issues, particularly if you are a bit slow like me;

1). Creating the BasePage was pretty straight forward as was editing the sites pages created for Title="" BUT if after you have done this,you then open any of the old Demos (try outs) you may have kept you will get errors. To address this the search for Title="" will or in my case did NOT work. Instead you have to edit each page for <title></title> and put a title between these markups.

2). Page 215 is baffling to read for the Template section. In the Try it out step 2 the reader is editing the CodeBehind page markup but Step 3 says 'Switch to Markup View' but doesn't identify that this is in the Temporaray.aspx file.

3). Step 4 which then states, 'Optionally, add other code...' is now completely unclear where this is meant to be? the Temporary.aspx file or the .aspx.cs file..

I have not gone further as I'd like to be clear before I go and simply blindly follow the rest of 'try it out steps' as it is not clear what the actions are doing and to what and how it affects the rest of the project files.

How have others added Comments\Copywrite to the temporary file?

Thanks
Phil
Reply With Quote
  #2 (permalink)  
Old March 31st, 2013, 12:20 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

1) Ah, yes, that might be an issue if you've added pages with your own formatting. Some might be handled using Find and Replace, others need manual fixing.

2) It's the same file, you can switch from code behind to markup view and from markup view to design view, all for the temp file. So, it's just referring to the ASPX part of the .cs or .vb file you're working on.

3) Wherever you want. Both the ASPX and the .cs / .vb file are sued in the template (to recreate the markup and code behind) so you can add whatever you want to either file.

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!
Reply With Quote
  #3 (permalink)  
Old April 1st, 2013, 06:18 AM
Registered User
Points: 21, Level: 1
Points: 21, Level: 1 Points: 21, Level: 1 Points: 21, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2013
Location: South West UK
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Thank you

Hi Imar,

Thank you for your response. I didn't know who may reply so hence the simple 'Hi' opener in my original post.

The Demo pages were added as part of working through each of the 'Try it out' sections so in the end I edited each of these separately to put a title in each to allow them to run again following editing the BasePage.

I think what is not clear is that, in the IDE, we 'appear' to have two files Temporary.aspx and Temporary.aspx.cs (in my case I am using C#) and for me reading the book there is the ability to view MarkUp option for either of these files. [ I hope that makes sense to you and any other readers].

I am little confused by your response to (3) as for example using your suggested idea of a Copywrite statement in the template I am not sure where it would sit and be entered. i.e as put in in design mode on the Temporary.aspx file or as marked as a kind of programatically defined attribute called copywrite set as

MyCopywrite=="This is Copywrite XYZ";

in either the markup for the aspx file or the code behind .aspx.cs file.

The text in the book seems to imply that we'll lose the ability to come back and fix this if we get it wrong later after we go beyond step 5 of the Try It Out.

Thanks again for your reply, I'm sure I'll work it out eventually but it is a bit of a change coming back to this after a long time out as I am an old timer used to working in Assembler language for various processors and memory maps.

Regards
Phil.
Reply With Quote
  #4 (permalink)  
Old April 2nd, 2013, 04:34 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi Phil,

Quote:
The Demo pages were added as part of working through each of the 'Try it out' sections so in the end I edited each of these separately to put a title in each to allow them to run again following editing the BasePage.
That's correct. Page 212, step 7 says:

Quote:
The fix is easy; just give them all a valid Title. For pages without a Title attribute in their page directive, you need to do this manually. For other pages, with an empty Title=”“ attribute, you can quickly do this by searching the site for Title=”“ and replacing it with something like Title=”Planet Wrox”.
Fortunately, this is a one-time only fix. With new pages, and empty title will be caught immediately so you can fix it right away. And again, you don't have to use this functionality. If you don't like it, simply don't check for empty titles in the BasePage.

Quote:
I think what is not clear is that, in the IDE, we 'appear' to have two files Temporary.aspx and Temporary.aspx.cs (in my case I am using C#) and for me reading the book there is the ability to view MarkUp option for either of these files. [ I hope that makes sense to you and any other readers].
I see. That's not the case though. Take a look at Chapter 2, page 47 - 49 for the different terms. The markup code (with the <angled> brackets etc.) is Markup View. The WYSIWYG view (where you see how the page looks) is called Design View. The Code Behind then refers to the C# or VB code in the .cs or .vb file.

Quote:
I am little confused by your response to (3) as for example using your suggested idea of a Copywrite statement in the template I am not sure where it would sit and be entered. i.e as put in in design mode on the Temporary.aspx file or as marked as a kind of programatically defined attribute called copywrite set as

MyCopywrite=="This is Copywrite XYZ";

in either the markup for the aspx file or the code behind .aspx.cs file.
Pretty much wherever you want it. The above statement would be invalid, but you could use comments instead. In Markup View you could so this:

Code:
<!-- Your text here -->
as <!-- and --> are interpreted as the start and end tags for HTML comments (that are sent to the client).

In Code Behind you could do this:

Code:
// Your text here
As // is the comments marker for C#/.

Quote:
The text in the book seems to imply that we'll lose the ability to come back and fix this if we get it wrong later after we go beyond step 5 of the Try It Out.
Yes and no. The final template code is compressed to a ZIP file which makes it difficult to edit it later. However, it's not impossible. Also, you can always delete the template's ZIP file and create another one with your own preferences.

Hope this clarifies things.

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!
Reply With Quote
  #5 (permalink)  
Old April 2nd, 2013, 02:31 PM
Registered User
Points: 21, Level: 1
Points: 21, Level: 1 Points: 21, Level: 1 Points: 21, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2013
Location: South West UK
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok and Thanks Imar,

I will say though that your knowledge is tacit (inferred without direct expression) so the reader is trying to follow without your 'tacit' knowledge. Hence I was clarifying incase somebody else got the error and did not ask. I did this particularly for the BasePage enforced Title error for example;

The demo files do not have any Markup as Title="" the reader has to find <title></title> and edit what is between these not search and use Title="" which is all the book text talks about.

Quote:
I see. That's not the case though. Take a look at Chapter 2, page 47 - 49 for the different terms. The markup code (with the <angled> brackets etc.) is Markup View. The WYSIWYG view (where you see how the page looks) is called Design View. The Code Behind then refers to the C# or VB code in the .cs or .vb file.
Is not entirely correct, the IDE does create two files, lets say we title form 'xyz' then it creates one as xyz.aspx and the second xyz.aspx.cs and both can be edited in Markup View, they are not the same (they do work as one when served to the browser) but not when being edited that was my point. This is not the same as WYSISWYG ( and I haven't used that term in many years )

I'll work on with the text though it is trying to cover a wide range of IDE aspects all in one rush many of which I don't think I'd use. Meanwhile I'll step out and not post here if I can help it as I feel at cross purposes and that this maybe unhelpful to others.

Phil.
Reply With Quote
  #6 (permalink)  
Old April 3rd, 2013, 03:25 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
Hence I was clarifying incase somebody else got the error and did not ask. I did this particularly for the BasePage enforced Title error for example;
Yes, I understand, and I very much appreciate that. However, in this case, your suggested fix was not what I mean in the book. The idea is to edit or add a Title attribute to the @Page directive; not change the <title> element. The text "just give them all a valid Title. For pages without a Title attribute in their page directive, you need to do this manually." was referring to that. I could have been clearer and could have said "you need to add this attribute manually".

Quote:
Is not entirely correct, the IDE does create two files, lets say we title form 'xyz' then it creates one as xyz.aspx and the second xyz.aspx.cs and both can be edited in Markup View,
Nope, and this is where the confusion is I think. Markup View refers to the part of the page that contains markup such as HTML and ASP.NET control declarations. Markup is a specific term referring to a document containing text and annotations (such as the HTML elements). It does not refer to the C# portion of the page. I think you're confusing Markup View with something more generic like the "code view", "code editor", or the "code window". It's important to understand what Markup View refers to as it's used quite often in the book..

If you add a new Web Form using C# Code Behind to your site you get two files: SomeFile.aspx and SomeFile.aspx.cs. Here, SomeFile.aspx contains the Markup (which can thus be referred to as the Markup View) and looks like this:

Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="SomeFile.aspx.vb" Inherits="SomeFile" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
  <title></title>
</head>
<body>
  <form id="form1" runat="server">
    <div>
    </div>
  </form>
</body>
</html>
The Code Behind contains the C# code and looks like this:

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class SomeFile : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {

  }
}
It would be incorrect to refer to this second file as Markup View as it does not contain markup, only C# code.

So, the .aspx part of the page can be viewed in three modes (Markup View, Design View and Split View), while the aspx.cs part is the Code Behind view.

Quote:
I'll work on with the text though it is trying to cover a wide range of IDE aspects all in one rush many of which I don't think I'd use.
Could you give some examples? Why would you not use them? I have tried to make the book as "real-world" as possible, covering those topics you're likely to encounter when building real-world web sites. Would love to hear what you think is not useful so I can reevaluate that for a future version.

Quote:
Meanwhile I'll step out and not post here if I can help it as I feel at cross purposes and that this maybe unhelpful to others.
On the contrary, I'd say. Posting here *is* useful for you and others. Having a discussion on ASP.NET, the book, and on anything that might be unclear to you can only be good as it may help you and other readers better understand the technology, and helps me understand what's clear and what's not in the book so I can improve it for the next version.

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!
Reply With Quote
  #7 (permalink)  
Old April 3rd, 2013, 07:42 PM
Registered User
Points: 21, Level: 1
Points: 21, Level: 1 Points: 21, Level: 1 Points: 21, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2013
Location: South West UK
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for Your reply Imar.

We agree then that as a reader that the 'title' text was not as easy to follow so my aim was to help.

MarkUp is in the IDE 'Source' tab and as an assembler coder its all 'markup= source' until it compiles. I take your point about the 'flavours' of markup. Terminology like 'markup' does not transfer easily to me. ( even you in your reply used Markup instead of Source ).

As regards what I don't think I'd use, I cannot be specific yet but, the main issue that deterrs me is the compexity of the IDE. This sets out with the intent of helping I am sure, but reality is adding lots of complexity. To somebody like me who is used to writing source code in a text editor and then compiling it it is a deterrant ( its a choice thing and you are trying to show a wide range of possibilities but at quite a pace).

Concepts the Theme and StyleSheetTheme implementations tend to leave me 'cold' as do terms like 'Skin'. More complex is not necesarily better, it simply complicates the process with paying attention to the IDE over the 'source code'. Like I said, its a choice thing for the user.

I am an old fashioned out of date technical hack, who doesn't think all things WWW are good or even beneficial, my terminology is different hence why better not post and confuse others.

The chapter is complete and all is working. I appreciate your time given to help.

Regards
Phil.
Reply With Quote
  #8 (permalink)  
Old April 4th, 2013, 02:54 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
even you in your reply used Markup instead of Source
Indeed, and as I explain in the book, that's a deliberate choice. Source View is too generic for me, and could easily refer to the source of a CSS, C# or JavaScript file, none of which would qualify as markup. In fact, the reason I use this Markup View is exactly to avoid the confusion that you now seem to have ;-)

Maybe you would have been better off looking at ASP.NET MVC instead of Web Forms. It's still using the same underlying ASP.NET framework, but it's "closer to the metal", without many of the smart controls and IDE features that Web Forms uses.

Quote:
I appreciate your time given to help.
You're welcome. And thank you too for your valuable feedback.

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!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
chapter 6 p226 preferred theme in basepage robbaralla BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 7 November 7th, 2009 11:24 AM
BasePage & MasterPage Rachel BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 December 25th, 2008 11:23 AM
BasePage Code for VB (Chapter 6) justinjones06 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 September 15th, 2008 01:50 AM
Edit an imported template, where & how? ismailc XSLT 2 January 18th, 2008 03:50 AM
Chpt 6 Why Not Try...template & navigation turtle10 Dreamweaver (all versions) 2 September 23rd, 2004 04:14 PM



All times are GMT -4. The time now is 10:21 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.