Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 6th, 2010, 02:37 PM
Banned
 
Join Date: Jan 2010
Location: Michigan
Posts: 22
Thanks: 10
Thanked 0 Times in 0 Posts
Default Chapter 8 NavigateURl

Imar,

I'm getting a error on the AboutUs.aspx.vb page with a squiggly line under the "Banner1.NavigateUrl" portion. When I mouse over it, it says " 'NavigateUrl is not a member of ' ASP.controls_banner_ascx'.

Below is my code. I tried to verify against the source you provide in your download but can't see the problem. Can you?

Thanks.
Code:
 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not Page.IsPostBack Then
       Banner1.NavigateUrl = "http://imar.spaanjaars.com"
    End If
  End Sub
Reply With Quote
  #2 (permalink)  
Old March 6th, 2010, 03:17 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 Chuck,

Can you post the code for the User Control and its Code Behind?

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 March 6th, 2010, 03:18 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

And the markup up for this page?

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
  #4 (permalink)  
Old March 6th, 2010, 06:22 PM
Banned
 
Join Date: Jan 2010
Location: Michigan
Posts: 22
Thanks: 10
Thanked 0 Times in 0 Posts
Default

User Control markup:
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 Vertical 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 Horizonal banner" 
    ImageUrl="~/Images/Banner468x60.gif" />
  </a>  
</asp:Panel>
User Control code behind:

Code:
 

Partial Class Controls_Banner
    Inherits System.Web.UI.UserControl

  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
        pnlHorizontal.Visible = True
        lnkHorizontal.Href = NavigateUrl
      Case Direction.Vertical
        pnlVertical.Visible = True
        lnkVertical.Href = NavigateUrl
    End Select

  End Sub


  Private _displayDirection As Direction = Direction.Vertical ' the = Direction.Vertical is not necessary
  Public Property DisplayDirection() As Direction
    Get
      Return _displayDirection
    End Get
    Set(ByVal value As Direction)
      _displayDirection = value
    End Set
  End Property



  Public Property NavigateUrl() As String
    Get
      Dim _navigateUrl As Object = ViewState("NavigateUrl")
      If _navigateUrl IsNot Nothing Then
        Return CType(_navigateUrl, String)
      Else
        Return "http://p2p.wrox.com"
      End If
    End Get
    Set(ByVal value As String)
      ViewState("NavigateUrl") = value
    End Set
  End Property
Markup for AboutUs
Code:
<%@ Page Title="About Us" Language="VB" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="false" CodeFile="AboutUs.aspx.vb" Inherits="AboutUs" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
  <h1>About Us</h1>
  <p>This site is for those that love music and love to discuss music
     You are welcome to add your views and comments to the site and to 
     share you pictures and comments from shows and concerts you have attended.
  </p>
     
  <asp:Button ID="Button1" runat="server" Text="Button" />
   <br />
   <br />


  <!-- The line below is the User Control declaration for the banner --> 
  <Wrox:Banner ID="Banner1" runat="server" DisplayDirection="Horizontal" />
  
</asp:Content>
Thanks
Reply With Quote
  #5 (permalink)  
Old March 6th, 2010, 06:27 PM
Banned
 
Join Date: Jan 2010
Location: Michigan
Posts: 22
Thanks: 10
Thanked 0 Times in 0 Posts
Default Don't spend time looking at the code

Imar,

I'm not sure what cleard it up but I no longer get the error. I thought I save everything and compiled it but appearently I didn't.

Thanks for your time,

Chuck
Reply With Quote
  #6 (permalink)  
Old March 7th, 2010, 07:52 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

You're welcome ;-) Glad it's working now...

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
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 - Code Download Missing for this Chapter dbaechtel BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 0 August 11th, 2009 11:02 AM
NavigateUrl and Target spacy ASP.NET 1.x and 2.0 Application Design 9 November 5th, 2007 12:23 PM
Generics chapter 12 difficult chapter i found ...? Larryz C# 2005 1 July 4th, 2007 09:40 PM
Strange Problem with NavigateUrl in TreeView kalchev ASP.NET 2.0 Basics 3 May 2nd, 2006 02:38 AM



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


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