Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET Web Pages with WebMatrix
This is the forum to discuss the Wrox book Beginning ASP.NET Web Pages with WebMatrix by Mike Brind, Imar Spaanjaars ; ISBN: 978-1-1180-5048-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET Web Pages with WebMatrix 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 Display Modes
  #1 (permalink)  
Old December 31st, 2011, 03:46 PM
Authorized User
Points: 313, Level: 6
Points: 313, Level: 6 Points: 313, Level: 6 Points: 313, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Posts: 74
Thanks: 21
Thanked 2 Times in 2 Posts
Default Chapter 3 Nested Layout Pages

Nesting Layout Pages (TRY IT OUT starting page 62)

MainLayout.cshtml will run referencing (using) _MainLayout.cshtml just fine, however both Automation.cshtml and Electronics.cshtml give me the error: "name 'Renderbody' does not exist in the current context."

I suspect it's an "obvious" file linking error I'm just missing, because MainLayout.cshtml runs just fine, so why can't the other two find @Renderbody? I also suspect MainLayout.cshtml runs because it has more HTML code to RENDER the page than the other two, which might be part of my problem.

I found errata on page 64 in #8 where there's a missing semicolon at the end of "Layout...cshtml";" That fixed and asside, I cannot otherwise seem to figure out what's wrong here.

Here's a copy and paste of my code for _ElectronicsLayout.cshtml, ...

@{
Layout = "~/Shared/_MainLayout.cshtml";
}

<div id="electronicsnav">
<a href="Products">Products</a> <br/>
<a href="Services">Services</a> <br/>
<a href="Support">Support</a> <br/>
<a href="Team">Team</a> <br/>
</div>
<div id="electronics">
@Renderbody( )
</div>
<div id="footer">The Electronics Division Footer</div>

+++++++++++++++++++++

Here's the code for Electronics.cshtml which references _ElectronicsLayout.cshtml (above code)...

@{

Layout = "~/Shared/_ElectronicsLayout.cshtml";
Page.Title = "Electronics";
}
<h3>Electronics Home Page</h3>

Added here after initial posting!
Could it be that Automation.cshtml and Electronics.cshtml are looking for Page.title?

Last edited by jpjamie; December 31st, 2011 at 03:51 PM. Reason: Discovery
Reply With Quote
  #2 (permalink)  
Old December 31st, 2011, 04:36 PM
Authorized User
Points: 313, Level: 6
Points: 313, Level: 6 Points: 313, Level: 6 Points: 313, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Posts: 74
Thanks: 21
Thanked 2 Times in 2 Posts
Default UpperCaseMatters

I figured it all out and I'm embarrassed to say it was @RenderBody() NOT @Renderbody() that caused all my problems. I knew it wasn't a code/logic problem and something I just was missing.

Now I have a few hours out of my life missing as well!!

NEVER MIND! DUH!

JJ
Reply With Quote
Reply


Thread Tools
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
Problem with Nested master pages SouthendSupporter ASP.NET 3.5 Basics 1 March 3rd, 2011 10:15 AM
Problem in nested master pages. harsh.kintu ASP.NET 2.0 Professional 2 January 9th, 2007 10:04 AM
strange "errors" with nested master pages... thenoseknows ASP.NET 2.0 Professional 2 November 28th, 2006 05:28 PM
Chapter 5 - Try It Out: Pages 208-210 Wyatt70 BOOK: Beginning XML 3rd Edition 5 November 22nd, 2006 06:54 AM
Chapter 9 Protecting Your Pages malhyp Dreamweaver (all versions) 1 August 20th, 2005 05:14 AM



All times are GMT -4. The time now is 06:12 AM.


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