Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics 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 Display Modes
  #1 (permalink)  
Old March 8th, 2008, 01:19 AM
Registered User
 
Join Date: Mar 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help, what code should I write here?

when mouse over the hotspot, IE status bar displayed "Error on Page".

my code as below:

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" Title="?????????" %>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
<form id="Display_Sample" action="~/products.aspx" method="POST">
<table style="width:450px;height:550px">
    <tr style="width:100%; height:450px">
    <td>
   <asp:image id="DisplayProduct" runat="server" ImageUrl="~/Images/Sample_CanadianWinter.gif" AlternateText="???"/>
    </td>
    </tr>
    <tr style="width:100%; height:100px"><td>
    <img style="border:0" id="Product_Grid" runat="server" src="~/Images/Sample_Grid10Ft.gif" mce_src="~/Images/Sample_Grid10Ft.gif" usemap="#DisplayProductPallet" alt=""/>
    </td>
    </tr>
</table>
    <map id="DisplayProductPallet">
    <area shape="rect" coords="5,5,100,105" href="http://forums.asp.net/AddPost.aspx?ForumID=15#" mce_href="http://forums.asp.net/AddPost.aspx?ForumID=15#" alt="Canadian Winter"
    onmouseover="window.document.Content1.ContentPlace Holder1.Display_Sample.DisplayProduct.ImageUrl='~/Images/Sample_CanadianPaint.gif'"/>
    </map>
</form>

</asp:Content>

is it correct I am using window.document...?


Reply With Quote
  #2 (permalink)  
Old March 10th, 2008, 10:07 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The problem here is that the client knows nothing about .NET. Therefore, using an object oriented naming pattern has no meaning. Look are the emitted HTML for this page and you are going to see something much different in the image control's name and ID attribute. However, don't just use what you see there as it might change depending on the behavior of the page (those are names generated by the ASP.NET runtime). Ideally, you should write some codebehind to emit the javascript with the unique client ID of the image control. You might be able to get away with something like this:

<area shape="rect" coords="5,5,100,105" href="http://forums.asp.net/AddPost.aspx?ForumID=15#" mce_href="http://forums.asp.net/AddPost.aspx?ForumID=15#" alt="Canadian Winter" onmouseover="<%=DisplayProduct.ClientID%>.url='~/Images/Sample_CanadianPaint.gif'"/>

This should emit the DisplayProduct image control unique clientID to the area tag.

-Peter
peterlanoie.blog
Reply With Quote
  #3 (permalink)  
Old March 10th, 2008, 10:09 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Oh, and I had something wrong... it should be ".src" not ".url" for the client side image url attribute of the image. Also, using the ~ syntax in the client side doesn't work either. You need to fully qualify the image URL.

Try this:

<area shape="rect" coords="5,5,100,105" href="http://forums.asp.net/AddPost.aspx?ForumID=15#" mce_href="http://forums.asp.net/AddPost.aspx?ForumID=15#" alt="Canadian Winter" onmouseover="<%=DisplayProduct.ClientID%>.src='<%= ResolveUrl("~/Images/Sample_CanadianPaint.gif")%>'"/>

-Peter
peterlanoie.blog
Reply With Quote
Reply


Thread Tools
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
How do i write code to go back or undo sanderson Beginning VB 6 1 July 9th, 2008 05:10 PM
re write a code kgoldvas XSLT 3 August 1st, 2007 07:40 AM
how write vb code in c# ravpaw General .NET 2 July 1st, 2007 02:13 PM
How to write code to draw bouncing circles Bimbo VB How-To 1 November 11th, 2005 01:17 PM
Can I write ASP code in Dreamweaver? Ben Horne Dreamweaver (all versions) 13 December 4th, 2003 03:00 PM



All times are GMT -4. The time now is 12:11 PM.


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