473,402 Members | 2,072 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Image control not getting src

I have an asp:Image control that I want to have it's src url to change using
OnClientClick of a set of images in a DataList. All works fine, except the
single Image control is not displaying the image, just a red X. My separate
DataList records have this
OnClientClick="return showpic(this);"

The javascript function is as follows:

function showpic(obj)
{
var bigpic = document.getElementById("ImgLarge");
bigpic.className = 'Show';
bigpic.src = obj.src;
return false;
}
Any ideas what I am doing wrong? Thanks.

David
May 1 '07 #1
2 1812
one of two possibilities.

1. you are using the images real id, try:

var bigpic = document.getElementById("<%=ImgLarge.ClientID%>");

2. your onclick is not attached to an image so src is undefined. view
source to see which html control showpic is attached to.
-- bruce (sqlwork.com)

David C wrote:
I have an asp:Image control that I want to have it's src url to change using
OnClientClick of a set of images in a DataList. All works fine, except the
single Image control is not displaying the image, just a red X. My separate
DataList records have this
OnClientClick="return showpic(this);"

The javascript function is as follows:

function showpic(obj)
{
var bigpic = document.getElementById("ImgLarge");
bigpic.className = 'Show';
bigpic.src = obj.src;
return false;
}
Any ideas what I am doing wrong? Thanks.

David

May 1 '07 #2
Below is how I solved it. I made a variable for obj.src and then it worked.
Thanks.

function showpic(obj)

{

var bigpic = document.getElementById("ImgLarge");

bigpic.className = 'Show';

var varsrc = obj.src;

bigpic.src = varsrc;

return false;

}
"bruce barker" <no****@nospam.comwrote in message
news:%2***************@TK2MSFTNGP04.phx.gbl...
one of two possibilities.

1. you are using the images real id, try:

var bigpic = document.getElementById("<%=ImgLarge.ClientID%>");

2. your onclick is not attached to an image so src is undefined. view
source to see which html control showpic is attached to.
-- bruce (sqlwork.com)

David C wrote:
>I have an asp:Image control that I want to have it's src url to change
using OnClientClick of a set of images in a DataList. All works fine,
except the single Image control is not displaying the image, just a red
X. My separate DataList records have this
OnClientClick="return showpic(this);"

The javascript function is as follows:

function showpic(obj)
{
var bigpic = document.getElementById("ImgLarge");
bigpic.className = 'Show';
bigpic.src = obj.src;
return false;
}
Any ideas what I am doing wrong? Thanks.

David
May 1 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Greg Christie | last post by:
I think I have a somewhat unique situation here, so I thought I should post it for the few poor souls who run across it and try to google it like I did. First of all, I was getting the following...
4
by: Kevin Myers | last post by:
Hello, Please forgive my reposting of this note with hopefully a more relevant subject line. On an Access 2000 form under Windows 2000 I would like to use a Kodak Image Edit Control to...
11
by: KarimL | last post by:
Thanks for your advices... but i need to get the Image height because i dynamically resize the height of my webcontrol based on the image height. More i just have the url (relative parth) to the...
7
by: Scott Schluer | last post by:
Is there a way to use the Image class to convert a color photo (GIF or JPEG) to a B&W photo? Thanks, Scott
1
by: Thubaiti | last post by:
Hi, I have an image web control with other web controls.. <asp:Image id="itemImage" runat="server"></asp:Image> <asp:Label id="itemNameLabel" runat="server"></asp:Label> <asp:Label...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
3
by: Dave | last post by:
Hey all, I have a problem and I can't find anything on the net to really address it. We have a program at work that has lots of numbers on the front of the form because it is a control program...
2
by: sanju | last post by:
Hi, I am struggling to replace a bit value 'True' or 'False' with a image true.gif or false.gif and bind it to a repeater control. I am getting values 'true' or 'false' depending on whether...
2
by: Tina | last post by:
I have a System.Drawing.Bitmap myImage; I also have a webcontrols.Image on my web page. I want to put the bitmap into the image but the image can only get it's bitmap from ImageURL which can be a...
3
by: premprakashbhati | last post by:
hi, good evening.. i am going to upload an image in a web form .....for that iam using HTML input(file) control and one web control button i.e., Upload_Button() here is the code ...its work fine...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.