Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 June 29th, 2015, 05:57 AM
Authorized User
 
Join Date: May 2015
Posts: 46
Thanks: 1
Thanked 0 Times in 0 Posts
Default chapter 8 (User Control) some problem

In page 290 Try it out (Implementing the NavigateUrl Property) step number 6
When I type the
Code:
 HorizontalLink.HRef = NavigateUrl
and
Code:
VerticalLink.HRef = NavigateUrl
in code behind in control/banner.ascx.vb
directly there is blue underline in HorizontalLink and VerticalLink
In correction options (this two attribute in not declared)

Last edited by SHOOGN; June 29th, 2015 at 05:59 AM..
 
Old June 29th, 2015, 06:34 AM
Authorized User
 
Join Date: May 2015
Posts: 46
Thanks: 1
Thanked 0 Times in 0 Posts
Default

One mistake and all things now is bad
the reason is Banner ...and I deleted the page and I will read this chapter for second time (hmmmm) very sad
I want to continuous even arrive to database chapter and with this type I think is very difficult
 
Old July 1st, 2015, 08:20 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You don't *have* to delete the file and start over; you can also compare your code with mine that comes with the book. Issues like this are often caused by simple typos or other errors.

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!
 
Old July 5th, 2015, 03:36 AM
Authorized User
 
Join Date: May 2015
Posts: 46
Thanks: 1
Thanked 0 Times in 0 Posts
Default

the same things now it happen again
when I add the :
runat="server" id="horizontallink" to the image herf in banner control file, the two image disappear from design view
 
Old July 7th, 2015, 10:42 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Can you post the code for control and the page that uses it? (Markup and Code Behind please).

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!
 
Old July 8th, 2015, 05:30 AM
Authorized User
 
Join Date: May 2015
Posts: 46
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Ok ....Hi Imar
this is banner's code (Markup) (the wrong happend when I add the Id for herf Image)
Code:
 <%@ Control Language="VB" AutoEventWireup="false" CodeFile="Banner.ascx.vb" Inherits="Controls_Banner" %>
<asp:Panel ID="VerticalPanel" runat="server">
    <a href="http://P2P.wrox.com"target="_blank " runat="server id="VertivalLink">
    <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/Banner120x240.gif" 
    AlternateText="This is a sample banner" />
</a>
</asp:Panel>
<asp:Panel ID="HorizontalPanel" runat="server">
    <a href="http://P2P.wrox.com"target="_blank " runat="server" id="HorizontalLink>
    <asp:Image ID="Image2" runat="server" ImageUrl="~/Images/Banner468x60.gif" 
    AlternateText="This is a sample banner" />
</a>
</asp:Panel>
and this is code behind for user control (Banner)
Code:
Partial Class Controls_Banner
    Inherits System.Web.UI.UserControl
    Public Property DisplayDirection As Direction
    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"  ' Return a default value
            End If
        End Get
        Set(ByVal Value As String)
            ViewState("NavigateUrl") = Value
        End Set
    End Property
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        Horizontalpanel.Visible = False
        VerticalPanel.Visible = False

        Select Case DisplayDirection
            Case Direction.horizontal
                HorizontalPanel.Visible = True
                HorizontalLink.HRef = NavigateUrl

            Case Direction.vertical
                VerticalPanel.Visible = True
                VerticalLink.HRef = NavigateUrl
        End Select
    End Sub
End Class

this is code behind for Aboutus.aspx page I want add banner to it
Code:
Partial Class About_AboutUs
    Inherits BasePage

    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Banner2.DisplayDirection = Direction.vertical
            Banner2.NavigateUrl = "http://imar.spaanjaars.com"
        End If
    End Sub
End Class
And the markup view for same page
Code:
<%@ Page Title="About Us" Language="VB" MasterPageFile="~/MasterPages/Frontend.master" AutoEventWireup="false" CodeFile="AboutUs.aspx.vb" Inherits="About_AboutUs" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
    <asp:Button ID="Button1" runat="server" Text="Button" />      
    <wrox:Banner ID="Banner2" runat="server" DisplayDirection="horizontal" />
</asp:Content>
 
Old July 8th, 2015, 07:52 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I can see a couple things wrong in your code:

Quote:
<a href="http://P2P.wrox.com"target="_blank " runat="server id="VertivalLink">
Note that there is no space between the " and target. There's also an extra space after _blank. You're then missing another quote after server and finally, you have VertivalLink instead of VerticalLink.

Try this instead:

<a href="http://P2P.wrox.com" target="_blank" runat="server" id="VerticalLink">

You'll need to apply similar fixes to the horizontal link which is also missing a closing " character at the end.

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!
 
Old July 12th, 2015, 04:22 AM
Authorized User
 
Join Date: May 2015
Posts: 46
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks a lot
Now it's working the wrong there is no space between quote and target and some typo
thanks Imar
from now I will not remove any page





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 8 user control properties MarshallN BOOK: Beginning ASP.NET 4 : in C# and VB 5 December 5th, 2011 06:18 AM
Chapter 8 User control avs BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 18 December 29th, 2009 09:17 PM
Chapter 8:User Control Arya BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 December 18th, 2009 04:37 PM
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





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