 |
| 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 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
|
|
|
|

October 1st, 2006, 02:32 PM
|
|
Authorized User
|
|
Join Date: Aug 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

October 1st, 2006, 07:20 PM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
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.
|
|

October 2nd, 2006, 03:58 AM
|
|
Authorized User
|
|
Join Date: Aug 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

October 2nd, 2006, 07:21 AM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
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.
|
|

October 2nd, 2006, 11:28 AM
|
|
Authorized User
|
|
Join Date: Aug 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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?
|
|

October 2nd, 2006, 12:10 PM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
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.
|
|

October 2nd, 2006, 12:15 PM
|
|
Authorized User
|
|
Join Date: Aug 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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!
|
|

October 2nd, 2006, 12:30 PM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
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.
|
|

October 2nd, 2006, 12:41 PM
|
|
Authorized User
|
|
Join Date: Aug 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

October 2nd, 2006, 12:50 PM
|
|
Authorized User
|
|
Join Date: Aug 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I think here is the problem with >"< (to many)
|
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 02: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 01:41 PM |
| Javascript problem |
highcliffevillage |
Javascript How-To |
0 |
July 8th, 2004 07:13 AM |
|
 |