Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics 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
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 18th, 2008, 01:13 PM
Registered User
Points: 25, Level: 1
Points: 25, Level: 1 Points: 25, Level: 1 Points: 25, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2008
Location: Glastonbury, CT, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to janla2112
Default Chapter 8 - Implementing ViewState Properties

Hi,
I have learned a lot from this book and expect to re-read it many times in the future to re-learn things as I need them. I have been able to Debug all of the mistakes I have made and even found one in the book that was incorrect after Microsoft went to SP1. I would have to go back and find it, but it had to do with getting rid of all the closing tags down to one. I will get back to you on that one.

Anyways. I am trying to run the exercise "Implementing the NavigateUrl Property on page 283, however I run into the following Compilation Errors:

Error 1 C:\BegASPNET\Site\Controls\Banner.ascx.vb(21): error BC30451: Name 'lnkHorizontal' is not declared.

Error 2 C:\BegASPNET\Site\Controls\Banner.ascx.vb(21): error BC30451: Name 'lnkHorizontal' is not declared.


Error 3 C:\BegASPNET\Site\Controls\Banner.ascx.vb(21): error BC30451: Name 'lnkHorizontal' is not declared.

Error 4 C:\BegASPNET\Site\Controls\Banner.ascx.vb(21): error BC30451: Name 'lnkHorizontal' is not declared.

Error 5 'NavigateUrl' is not a member of 'ASP.controls_banner_ascx'. C:\BegASPNET\Site\About\AboutUs.aspx.vb 7 7 C:\BegASPNET\Site
Error 6 Name 'lnkHorizontal' is not declared. C:\BegASPNET\Site\Controls\Banner.ascx.vb 21 9 C:\BegASPNET\SiteError 7 Name 'NavigateUrl' is not declared. C:\BegASPNET\Site\Controls\Banner.ascx.vb 21 30 C:\BegASPNET\SiteError 8 Name 'lnkVertical' is not declared. C:\BegASPNET\Site\Controls\Banner.ascx.vb 24 9 C:\BegASPNET\SiteError 9 Name 'NavigateUrl' is not declared. C:\BegASPNET\Site\Controls\Banner.ascx.vb 24 28 C:\BegASPNET\Site
I believe I have done everything by the letter, but can't seem to get past this. I can't figure out where it should be declared if it isn't. I appreciate any help.

Thanks,

Jan
  #2 (permalink)  
Old October 18th, 2008, 06:43 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 Jan,

Can you post the code for the user control; both the .ascx code and the code behind?

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
  #3 (permalink)  
Old October 19th, 2008, 09:35 AM
Registered User
Points: 25, Level: 1
Points: 25, Level: 1 Points: 25, Level: 1 Points: 25, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2008
Location: Glastonbury, CT, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to janla2112
Default

Hi Imar:
Here is the user control banner code:

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Banner.ascx.vb" Inherits="Controls_Banner" %>
<asp:Panel ID="pnlVertical" runat="server">
  <a href="http://p2p.wrox.com" target="_blank"> runat="server" id="lnkVertical">
  <asp:Image ID="Image1" runat="server" AlternateText="This is a simple banner"
          ImageUrl="~/Images/Banner120x240.gif" />
  </a>
</asp:Panel>
<asp:Panel ID="pnlHorizontal" runat="server">
  <a href="http://p2p.wrox.com" target="_blank"> runat="server" id="lnkHorizontal">
  <asp:Image ID="Image2" runat="server" AlternateText="This is a simple banner"
          ImageUrl="~/Images/Banner468X60.gif" />
  </a>
</asp:Panel>

and the code behind:

Partial Class Controls_Banner
    Inherits System.Web.UI.UserControl
  Private _displayDirection As direction = direction.Vertical

  Public Property DisplayDirection() As direction
    Get
      Return _displayDirection
    End Get
    Set(ByVal value As direction)
      _displayDirection = value
    End Set
  End Property

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    pnlHorizontal.Visible = False
    pnlVertical.Visible = False

    Select Case DisplayDirection
      Case direction.Horizontal
        lnkHorizontal.Href = NavigateUrl
      Case direction.Vertical
        pnlVertical.Visible = True
        lnkVertical.HRef = NavigateUrl
    End Select
  End Sub
End Class


I couldn't figure out what I did wrong.

Thanks for your help!

Jan
  #4 (permalink)  
Old October 21st, 2008, 03:17 PM
Registered User
Points: 25, Level: 1
Points: 25, Level: 1 Points: 25, Level: 1 Points: 25, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2008
Location: Glastonbury, CT, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to janla2112
Default

I figured it out. I did not move a closing tag to the end of a line, when I was adding code to the page behind so Banner and Banner1 were not being recognized.:)

Jan
  #5 (permalink)  
Old October 21st, 2008, 03:57 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

Glad you figured it out, and sorry for not responding to your reply; somehow I completely overlooked your post (looks like I didn't get a notification).

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 


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 4: Controls, ViewState and Events BazNZ BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 July 14th, 2008 03:57 AM
Chapter 5 - Properties neildobson BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 8 February 28th, 2005 06:03 AM



All times are GMT -4. The time now is 07:09 PM.


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