View Single Post
  #3 (permalink)  
Old October 19th, 2008, 09:35 AM
janla2112 janla2112 is offline
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