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 May 1st, 2012, 03:24 AM
Authorized User
 
Join Date: Apr 2012
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Armaan
Default Image

Hi sir,
on page 277 try it out exercise i added the page to my master page.
Now the page display in browser. But you said in previous exercise that when we clicked the image it should end up an empty page having only image in it for which we have added target="_blank" in <a> element. My pages does not perform this funcationality. I am sending you my Banner.ascx code and master page code please guide.
banner.ascx code
Code:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Banner.ascx.cs" Inherits="Controls_Banner" %>
<asp:Panel ID="VerticalPanel1" runat="server">
 <a href="http://p2p.wrox.com" target="_blank">
  <asp:Image ID="Image1" runat="server" AlternateText="This is a sample banner" 
    ImageUrl="~/Images/Banner120x240.gif" Width="128px" />
    </a>
</asp:Panel>
master page code
Code:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Frontend.master.cs" Inherits="MasterPages_Frontend" %>

<%@ Register src="~/Controls/Banner.ascx" tagname="Banner" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
  <div id="PageWrapper">
    <div id="Header"><a href="~/" runat="server">
    </a>
      <br />
      <br />
      <br />
      <br />
   </div>

    <div id="MenuWrapper">
      <asp:Menu ID="Menu1" runat="server" CssClass="MainMenu" 
        DataSourceID="SiteMapDataSource1" Orientation="Horizontal" 
        StaticEnableDefaultPopOutImage="False">
      </asp:Menu>
      <asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" 
        ShowExpandCollapse="False"><LevelStyles>
  <asp:TreeNodeStyle CssClass="FirstLevelMenuItems" />
</LevelStyles>
      </asp:TreeView>
      <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" 
        ShowStartingNode="False" />
    </div>
    <div id="MainContent">
      <asp:SiteMapPath ID="SiteMapPath1" runat="server">
      </asp:SiteMapPath>
      <br/>
      <br/>
     <asp:ContentPlaceHolder ID="cpMainContent" runat="server" >  
      </asp:ContentPlaceHolder>
    </div>
    <div id="Sidebar"> Select the Theme<asp:DropDownList ID="ThemeList" 
        runat="server" AutoPostBack="True" 
        onselectedindexchanged="ThemeList_SelectedIndexChanged">
      <asp:ListItem>Monochrome</asp:ListItem>
      <asp:ListItem>DarkGrey</asp:ListItem>
    </asp:DropDownList>
      <br />
      <uc1:Banner ID="Banner1" runat="server" />
      <br />
      <br />
    </div>
    
    <div id="Footer">Footer Goes Here</div>
  </div>
</form>
</body>
</html>
 
Old May 1st, 2012, 03:39 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Armaan,
Quote:
But you said in previous exercise that when we clicked the image it should end up an empty page having only image in it for which we have added target="_blank" in <a> element.
Not sure what you're referring to. You added the target="_blank" to the <a> element which should cause the link to open in a new window. E.g. when you click it, you go to http://p2p.wrox.com in a new browser window.

The exercise on page 277 ends with:

Quote:
When you click the banner, a new window is opened that takes you to the site you linked to in the previous exercise.
Your code will do exactly that....

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 May 1st, 2012, 05:51 AM
Authorized User
 
Join Date: Apr 2012
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Armaan
Default image

Sir,
i am asking that my banner does not appear to be be a link. When i take mouse on the banner mouse icon does not change from an arrow to hand. That means the banner is not acting as hyper link.
 
Old May 1st, 2012, 05:58 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

And what happens when you click it?

Can you post the final HTML code for the page in the browser? I can't see anything odd in the code for the control you posted and it works when I copy it into my site.

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 May 2nd, 2012, 01:18 PM
Authorized User
 
Join Date: Apr 2012
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Armaan
Default image

Sir
the problem has been resovled.Now it is working right.
Thanks.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Upload image-create & save thumbnail-display image angshujit ASP.NET 2.0 Professional 6 July 11th, 2013 10:34 PM
How to: Upload image to server and save image name in db with other form info Clint PHP How-To 1 October 26th, 2009 05:50 AM
Copy kodak image edit control's image to clipboard vishwanathduddilla Visual Studio 2005 0 November 3rd, 2008 10:10 AM
set image on <asp:Image> stored in DataBase myself.panku ASP.NET 2.0 Professional 1 August 11th, 2008 10:41 AM
Document Image Processing (DIP) - changing image f ALcom Access 0 March 27th, 2006 06:10 AM





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