Click here to Skip to main content
12,953,700 members (44,283 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi, I have been trying to get this straight but the requirements changed and now I cant seem to get it working. I am getting Data from an access database, and in that data there is an attribute titled "LINK_STATUS" which is a binary column. The values are limited to 0 and 1. First I was tasked to change the color of the rows as red or green based on link status i.e. 0 for red and 1 for green. I did that but now I have been told to add a column to the gridview that will contain .gif animations. I have to display Green blinking .gif for 1 and Red for 0. I have been trying to get it done for a long time, anyone please help me?
Posted 4-Dec-12 4:31am
09hadi763
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Use two image files 0.gif (for red) and 1.gif (for green). Read LINK_STATUS from database and concatenate ".gif" to the value(0 or 1) and assign to the image column as Image file name
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

First add a hyperlink field to the gridview and then:
<blockquote class="FQ"><div class="FQA">Quote:</div> if (e.Row.DataItem != null)
            {
                DataRowView drv = (DataRowView)e.Row.DataItem;
                string link_status = drv["link_status"].ToString();
 
                if (link_status == "0")
                {
                    TableCellCollection myCells = e.Row.Cells;
                    HyperLink planLink = (HyperLink)myCells[0].Controls[0];
                    planLink.ImageUrl = "~/gifs/red.gif";
                }
                else if (link_status == "1")
                {
                    TableCellCollection myCells = e.Row.Cells;
                    HyperLink planLink = (HyperLink)myCells[0].Controls[0];
                    planLink.ImageUrl = "~/gifs/green.gif";
                }
            }
            else
            { }</blockquote>
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,429
CHill60 3,490
Maciej Los 3,103
ppolymorphe 2,020
Jochen Arndt 1,975


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 20 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100