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.

Hide Image Problem

Hello,

I have an ASP:Datagrid where in each record I display an image.
The image I display can be one of two depending of the value of the
field "Level" of that record.

So for each record:
If level > 5 Then "images/high.gif" should be used.
Else "images/low.gif" should be used.

I have been trying with the HTML img tag and with the ASP:Image but
until now I wasn't able to do it.

For example, here it is the code I used for the HTML img tag:

<img src='<%# "images/" & If(DataBinder.Eval(Container.DataItem, "
level") > 5, "high.jpg", " low.gif") %>' />

Any idea how to solve this?

And should I use HTML img tag or ASP:Image?

Thank You For Your Help,
Miguel

Nov 19 '05 #1
1 1106
Try <img src='<%# GetImageSrc (DataBinder.Eval(Container.DataItem, "
level")) %>' />, where GetImageSrc is a method returning the right path
depending on the level value.

Eliyahu

"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
news:uO**************@TK2MSFTNGP09.phx.gbl...
Hello,

I have an ASP:Datagrid where in each record I display an image.
The image I display can be one of two depending of the value of the
field "Level" of that record.

So for each record:
If level > 5 Then "images/high.gif" should be used.
Else "images/low.gif" should be used.

I have been trying with the HTML img tag and with the ASP:Image but
until now I wasn't able to do it.

For example, here it is the code I used for the HTML img tag:

<img src='<%# "images/" & If(DataBinder.Eval(Container.DataItem, "
level") > 5, "high.jpg", " low.gif") %>' />

Any idea how to solve this?

And should I use HTML img tag or ASP:Image?

Thank You For Your Help,
Miguel

Nov 19 '05 #2

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

Similar topics

12
by: deko | last post by:
Is there any way to work around the blank space created by hidden divs? I'm trying to use a relatively postioned divs with show/hide behaviors to annotate an image. The divs show/hide...
10
by: David | last post by:
Hi everyone, Hoping there are some .js/browser experts out there that can help with this weird problem. I have made a swap div routine and applied the events to menu buttons with a closer...
5
by: Zambien | last post by:
Hi all, Here's my problem. I have tables that are using the menu/submenu idea for hiding rows. This works fine in IE (of course) and does show/hide correctly in netscape, but as soon as the...
0
by: Efkas | last post by:
I have a full custom application with some widged extending Controls like Label and PictureBox. I build a menu with these widgets. When I click on one of them, it calls a function to display...
3
by: | last post by:
I'm using the DataList and GridView controls, and I am trying to wrap my head around the problem of conditionally showing or hiding cells/cell content based on the presence or absence of DB data. I...
0
by: =?Utf-8?B?Sm9uIEdvbnphbGVz?= | last post by:
I have this email composed using System.Net.SmtpClient. I am successful in attaching image on the email and shows it to the body of the message by using HTML Tag <img src=image.jpg />. But the...
12
by: laredotornado | last post by:
Hi, I'm using PHP 5. I was wondering given an image, a.jpg, how can I make an image that would look like you slid a white index card (which I have a file, white.jpg with the same dimensions as...
6
by: Jeremy | last post by:
I've got a floating div which becomes visible when a link is clicked. I want the div to be hidden when the user clicks anywhere on the page except for whithin the div. What is the best way to do...
6
by: Doogie | last post by:
Hi I have an img control I am trying to hide upon certain types of commands in my code behind. When to hide it is directly tied to a asp:dropdownlist control. So depending on what the user...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.