Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 1st, 2006, 02:32 PM
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default javascript problem

i'm working on an asp.net application where i have some products with images. I'm using datagrid to represent the products on the web page. Now i'd like to enlarge the images when the mouse pointer is over the image (onmouseover event - popup). I found one example where these effect is used form just one image (you have to write image source manualy like below)

onmouseover="popup('<img src=logo.gif></img>')"

Now i would like to improve these function to dynamicly dispayed images. I tryed these but i get compilation error

onmouseover="popup('<img src='<%# DataBinder.Eval(Container.DataItem, "image_name") %>'></img>')"

Can anyone help me to solve these problem!

Thanks for your answers

  #2 (permalink)  
Old October 1st, 2006, 07:20 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

What was the compiler error?

--Stole this from a moderator

I will only tell you how to do it, not do it for you.  
Unless, of course, you want to hire me to do work for you.
  #3 (permalink)  
Old October 2nd, 2006, 03:58 AM
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The server tag is not well formed.


  #4 (permalink)  
Old October 2nd, 2006, 07:21 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Paste the entire server tag so i can take a look at it.

--Stole this from a moderator

I will only tell you how to do it, not do it for you.  
Unless, of course, you want to hire me to do work for you.
  #5 (permalink)  
Old October 2nd, 2006, 11:28 AM
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have chanced a little bit the code

function popup(msg)
{
    var content="<TABLE WIDTH='"+popwidth+"' BORDER='0' BORDERCOLOR=black CELLPADDING=1 CELLSPACING=0 "+"BGCOLOR=black><TD ALIGN='center'><img src='"+msg+"'</img></TD></TABLE>";

.... (not important)

This is the javascript function that i'm calling

<asp:HyperLink Runat=server onmouseover="popup('image.gif')" .... >  WORKS

<asp:HyperLink Runat=server onmouseover="popup('<%# "../gallery/" + DataBinder.Eval(Container.DataItem, "image_name") %>')" .... >   NOT WORKS

and this is the control which calls the function popup

I think the problem is the syntax of the parameter in popup function in hyperlink control, or not?

What is the right form?
  #6 (permalink)  
Old October 2nd, 2006, 12:10 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Here is the thing, the reason your server tag is malformed is because of "../gallery/" + you can't do that. You can try 2 things:

onmouseover="popup('../gallery/" + <%# DataBinder.Eval(Container.DataItem, "image_name") %> + "'")

or

When you return your result set, append ../gallery/ to the begining of your records (which doesn't mean to change the record, just manipulate the data)

SELECT '../gallery/' + imageField as popImage from Table

what will return a column whos format is ../gallery/[image path]

hth

--Stole this from a moderator

I will only tell you how to do it, not do it for you.  
Unless, of course, you want to hire me to do work for you.
  #7 (permalink)  
Old October 2nd, 2006, 12:15 PM
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tryed without > "../gallery/" + < and still don't works

i didn't forget to copy images in the same folder where the aspx file is!

  #8 (permalink)  
Old October 2nd, 2006, 12:30 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

When I bind items inside a datagrid I do exactly this (textbox example):

<asp:TextBox ID="txt" Text='<%# Container.DataItem("columnNane") %>' Runat=server> </asp:TextBox>

try doing this:

<asp:HyperLink Runat=server onmouseover="popup('" <%# Container.DataItem("image_name") %> +"')" runat=server>

--Stole this from a moderator

I will only tell you how to do it, not do it for you.  
Unless, of course, you want to hire me to do work for you.
  #9 (permalink)  
Old October 2nd, 2006, 12:41 PM
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nope, still nothing.

I also bind items like you Text='<%# Container.DataItem("columnNane") %>'

'<%# "../gallery/" + DataBinder.Eval(Container.DataItem, "image_name") %>'
this also works in imageUrl for example but not in javascript functions

  #10 (permalink)  
Old October 2nd, 2006, 12:50 PM
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think here is the problem with >"< (to many)

 


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
Javascript Problem suresh_accudocs ASP.NET 1.0 and 1.1 Professional 1 July 24th, 2007 06:04 PM
problem with javascript padmaja3 Other Programming Languages 0 February 8th, 2007 01:56 AM
JavaScript Problem @shish ASP.NET 1.0 and 1.1 Basics 1 April 3rd, 2006 10:26 AM
Javascript Problem dparsons ASP.NET 1.0 and 1.1 Basics 2 March 22nd, 2006 12:41 PM
Javascript problem highcliffevillage Javascript How-To 0 July 8th, 2004 07:13 AM



All times are GMT -4. The time now is 06:30 PM.


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