Dynamicaly displaying the images according to the different values for the field in the database

<asp:Image id=Image2 runat="server" Visible='<%# DataBinder.Eval(Container, "DataItem.INVENTORY_PO_ATTN").ToString() == "1" %>' ImageUrl="../Images/ingate_mini.gif" AlternateText="ATTN: Operations">
<asp:Image id=Image3 runat="server" Visible='<%# DataBinder.Eval(Container, "DataItem.INVENTORY_PO_ATTN").ToString() == "2" %>' ImageUrl="../Images/phone_mini.gif" AlternateText="ATTN: Sales">
<asp:Image id=Image1 runat="server" Visible='<%# DataBinder.Eval(Container, "DataItem.INVENTORY_PO_PAYMENT").ToString() == "1" &amp;&amp; DataBinder.Eval(Container, "DataItem.INVENTORY_PO_VINVOICE_GUID").ToString().Length == 0 %>' ImageUrl="../Images/custstatus.gif" AlternateText="Pay immediately">-------------------------------------------------------------->How to test 'or' condition instead of &amp;&amp; 
</asp:TemplateColumn>' runat="server">' runat="server">' runat="server">
4/20/2007 6:42:05 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 10
Get it on Google Play
Get it on Apple App Store

In the code you have mentioned three image controls. In the actual output how many images has to be there. Let me be clear in this part. So that we arrive at a solution based on this.


Ashok Raja

Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved.
4/20/2007 9:11:02 AM

Hi, Swati Jain: 

Here is the syntax for the IIF (VB.NET) in a datalist label:

<asp:Label ID="Label1" runat="server" Text='<%# IIF(Eval("showemail")="true","&lt;a href=mailto:" & Eval("email")& "&gt;myEmail&lt;a&gt;", "")%>'></asp:Label>

and the syntax for the this function in C#:

<asp:Label ID="Label1" runat="server" Text='<%# (Eval("showemail")!="true"?"&lt;a href=mailto:" + Eval("email")+ "&gt;Email&lt;a&gt;":"")%>'></asp:Label>

If the condition is true, then take the first value. Otherwise, the second value. In your case, it is a blank "".

ImageUrl='<%# (Eval("yesOrNo").Equals(true) ? "~/Images/logos/yes.gif" : (Eval("yesOrNo").Equals(false) ? "~/Images/logos/no.gif" : "~/Images/logos/blank.gif"))%>' />

Best Regards,
Rex Lin
Microsoft Online Community Support

If there is any question or the issue is not resolved, please feel free to mark the thread as not resolved
4/23/2007 2:36:14 AM

Similar Artilces:

Displaying image from database(image datatype) to image control
Hie all...I'm a newbie at asp.net. I m currently using asp.net 2.0.I m having a problem with displaying images on my web form. Have tried looking thru all codes but i can't find a step by step tutorial for doing so. I understand that in asp.net 1.1, the detailsview can automatically be linked to the image field and display the image. But this is not possible now. So, i have decided to just display the image in an image control.from my understanding, 1. retrieve image from database and convert it to temporary image file in a file path. 2. use the image control's imageurl to point to the file....

Display Image from database in an Image control
I have uploaded images to a database and now I want to display the images in an image control.  How do I do it?  Any help is appreciated. http://aspalliance.com/articleViewer.aspx?aId=140 ThanksMark post(s) as "Answer" that helped youElectronic ScrewWebsite||Blog||Dub@i.net I've read the article before and it is not what I'm looking to do, only half of what I'm looking to do.  I need to retrieve the data information from a database and bind the image to an image control not a datagrid or gridview or datalist, a label control. Its literally it tho...

Display image in image control from database?
Im looking for how to load an image in a database into an asp.net image control. I would like to be able to display images with assocated image captions in a page stored in a database. Samples I have found only deal with writing out the binary data directly into the page. Does anyone have a link on how to associate that image data in the database with an image control on the page? Have a look at this control in the control Gallery.  Should do what you want.JamesMy Blog: http://www.wintersfamily.plus.com/blogs/JamesWinters I found a few articles on this such as, http://blogs.ww...

Unale to display photos from database in Image control present inside Datalist.
I have a DataList in which fetches the photos stoted in SQL Server2000 database and trying to display them on an ASP.NET image control in the DataList. I am storing the name of the photo in a table column. The photos are originally stored in the images/members/ directory and the table column stores the names of these photos.  The code is as follows:- public partial class _Default : System.Web.UI.Page {    public string MemberPhoto;    SqlConnection conn = new SqlConnection("server='ABC';"      &nbs...

retrieving images from database and displaying on Image control
Hi all i need a solution for displaying an image which must be retrieved from database table(photo displaying).I used the following code,but it shows error as "Invalid Parameter used"   page_load() {   cn.Open ();        SqlCommand command = new SqlCommand ("select *from image1 ", cn);                                 byte[] image = (byte[])( command.ExecuteScalar());     &n...

How to display a image from database on to image control of the webpage
Hi....... I wann to get the image from datbase(SQL-SERVER) and display on to webpage..by passing this image to image control on aspx..page I did the above displaying image with out image control on aspx page...but i couldn't get how to pass this image(stream of bytes) to image control.. as image control takes image from url....is there any way to pass the image to image cntrol... Thanks in Advance.... Jaya.......... hello check this page, i guess that's what u want !!! Retrieving Images from SqlServer in ASP .NETBilal Hadiar, MCP, MCTS, MCPD, MCTMicrosoft MVP - Te...

Displaying an image in gridview field dependant of field value
Firstly I apologise in advance for my lack of knowledge, this is what I'm trying to achieve: I have a gridview (orders) that is populated based on a selection in another (customer), one of the fields is orderStatus this is an integer (0=outstanding, 1=in progress 2=complete) instead of displaying the integer value in my grid I would like to display an appropriate icon. I have managed to get the value of the field using:1 Protected Sub order_Rowcreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles order.RowCreated 2 If e.Ro...

Automatically caculate two values that are entered into two different fields and displayed in a Third Field
 Hello, I use the following code in a GridView page to caculate two values that are entered into two different fields and the result is displayed in the TotalHoursPerUnit field.  I am trying to convert the Code Behind The Page to work under the Protected Sub FormView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView1.DataBound, but no luck.  Please suggest a way to modify the statements to work with text boxes in a FormView control. Thank you in advance, ASPX Page <script language ="javascript"  type="text/javascript&qu...

displaying database fields in different objects
hi, i have a listbox that is bound to a database and shows all enteries under TITLE. I have a label next to listbox that i want to display a SOLUTION (from same database table as TITLE)  what i want to happen is that when a user clicks on a TITLE it puts the corresponding solution into the label any ideas?www.the-web-shed.com Very briefly... you would crete a query that retrieves the Solution, and that takes a Title as a parameter. In the Click event of the Listbox (or you could use a separate button for this), get the selected Title, and run the query, passin...

displaying an image based on database value
ok, let's see if i can accurately describe what i'm trying to do. i want to store the following information in a database (which i know how to do): item number, item description, etc...i want to store images in the filesystem with a filename [itemnumber].jpgthen i want to be able to view the data and display the appropriate image based on the item number stored in the dbi'm working in c# with an sql server 2005 db any ideas how to do this? thanks  What is your control of choice (Gridview?)? If it's a Gridview, you can use the RowDatabound event of the G...

how to i display a value of a field from database in textbox?
hi ppl!i'm in a problem, as a newbie with asp.net 2.0 (VB), here is my situation:I have a gridview which diaplays some fields, as in inbox of a mail server i.e with subject as its hyperlink field. What i want to do is to display the contents of the mail corresponding the subject which the user clicks in the textbox on the next page. I know it can be done using the session variable but i dont know how!!! i also want to know how a value of a field in gridview can be transferred to session variable and how it can be retreived into a textbox.  Any useful links or code sample will d...

Displaying images directly from database fields
Hi I'm developing an ASP.NET 2.0 data-driven website using Visual Web Developer 2005 Express Edition Beta and MS Access 2003. Since Access supports the data-type "OLE Object", I thought I'd try storing my images directly in database fields rather than as separate image files. I'm not sure if this is necessarily better, but wanted to try it and see. It seems to work as long as I use .BMP rather than .JPG format image files. Not ideal, but I can live with that. In Access, I've built a form that displays the images. The problem is when I try to display the same images in an ASP...

How do you display a url image in a database field?
One of the fields in my database contains a URL link to a banner ad. However, this Varchar field is displaying the HTML instead of the banner image. How does this field need to be set up to display the banner image? I am using Visual Web Developer 05 Express, SQL Server 05 Express, and MS SQL Server Management Studio Express. My host uses SQL Server 2005, ASP.net 2.0, and FrontPage extensions. Thanks How are you presenting your data, are you using a GridView or similar control? Marciehttp://www.datagridgirl.comNEW! http://www.gridviewgirl.com...

Display the database updatetime field value?
SQL Server Express - VWD 2005 Hey All I'm new to this whole web coding thing, so go gently on me! I am wondering, is it possible to display on a page the value that the database inserts in the updatetime field? I see this is represented as a system.byte field on a page, if you use the default fields from a table, or as a binary field in access 2k3. Just wondering if that could be used as a shortcut to having to enter/record my own everytime a record is changed?Thanks in advance NunnsbyEasy Going Guy ;-) Did u already write code to Insert Data to DB ? If so post those. If ...

Web resources about - Dynamicaly displaying the images according to the different values for the field in the database - asp.net.presentation-controls

Setup - NodeCanvas
Each actor that you want to be part of a Dialogue Tree must be assigned the Dialogue Actor Component. The Dialogue Actor Component holds information ...

SoMuch.com Active Server Pages Tips and Tricks
Helpful tips &amp tricks geared towards Active Server Pages programming, web design, and web developers..

Feelin : About
Feelin is an open-source object-oriented framework for the AmigaOS and its friends (AROS, MOS, AOS4). It provides a core API available as a shared ...

User account - GIMP Plugin Registry
Skip to main content GIMP Plugin Registry Main menu About Documentation Forums GIMP User Group Get Help Stay Updated! gimp.org Navigation FAQ ...

compiled for win32 bit - GIMP Plugin Registry
Skip to main content GIMP Plugin Registry Main menu About Documentation Forums GIMP User Group Get Help Stay Updated! gimp.org Navigation FAQ ...

Plugins & Scripts - GIMP Plugin Registry
Skip to main content GIMP Plugin Registry Main menu About Documentation Forums GIMP User Group Get Help Stay Updated! gimp.org Secondary menu ...

Resources last updated: 1/21/2016 2:27:35 PM