Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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 December 18th, 2009, 02:28 PM
Authorized User
 
Join Date: Dec 2009
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 8:User Control

Hi,
I am a beginner in ASP.Net and i am glad that i found the right book for me.
Currently, i am working on chapter 8, and i am on page 283(implementing the NavigateUrl property) .I am trying to add code to the code behind of AboutUs.aspx, where i get an error, that "Banner1 does not exist in current context". here is the code.

Code:
public partial class AboutUs : BasePage
{

    protected void Page_Load(object sender, EventArgs e)
    {
      if (!Page.IsPostBack)
      {
        Banner1.DisplayDirection = Direction.Vertical;
        
      }
    }
}
I also checked the ID of Banner in masterpage and it is the same as Banner1. Also everything before this seem to work perfectly fine. Could you pls let me know, where am i making mistake?

thanx!
Arya

Last edited by Arya; December 18th, 2009 at 02:31 PM..
 
Old December 18th, 2009, 03:18 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Arya,

Good to hear you like the book.

Did you also add the Banner control to the About page? The code in the code behind is using a Banner control defined in that page, not the one in the Master page (as it's not accessible from a page).

Hope this helps. If not, please post the Markup for the About page as well.

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!
The Following User Says Thank You to Imar For This Useful Post:
Arya (December 18th, 2009)
 
Old December 18th, 2009, 04:37 PM
Authorized User
 
Join Date: Dec 2009
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thank you Sir, for your prompt reply.
Now i got the point. I added Banner to to AboutUs.aspx. and then changed ID in code behind according to it. It solved an error.
thanx again
Arya





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Add User Control To The Tab Control cheer ASP.NET 3.5 Basics 1 February 25th, 2009 10:48 PM
Chapter 9 pps 314-316 Contact Form User Control Featheriver BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 February 2nd, 2009 03:19 AM
FileUploader user control chapter 5 psychonet BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 June 5th, 2007 08:18 AM
Chapter 10 User Control Problem sookarama BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 5 October 16th, 2006 06:24 AM
Add Windows User control in Web User Control agarwalvidhu C# 0 March 30th, 2006 01:17 AM





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