Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
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 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 October 18th, 2008, 01:13 PM
Registered User
 
Join Date: Oct 2008
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
 
Old October 18th, 2008, 06:43 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 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.
 
Old October 19th, 2008, 09:35 AM
Registered User
 
Join Date: Oct 2008
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
 
Old October 21st, 2008, 03:17 PM
Registered User
 
Join Date: Oct 2008
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
 
Old October 21st, 2008, 03:57 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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.





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





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