Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Blink Gridview Row  Color - Utilizing J-Query

Posted on 2013-11-18
4
Medium Priority
?
650 Views
Last Modified: 2013-11-26
Please review the attached code.   I need to Blink the "Background" Color of the entire "Gridview" row based on the value of column [12] utilizing "JQuery".   I do not want to Blink the text only the background color.

public partial class BigBoardDisp : System.Web.UI.Page
{

    protected void GridView1_RowDataBound (object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
            if (e.Row.Cells[6].Text == "AOG" || e.Row.Cells[6].Equals(DBNull.Value))
            {
                e.Row.BackColor = System.Drawing.Color.Red;
            }

            else if (e.Row.Cells[6].Text == "RDY")
            {
                e.Row.BackColor = System.Drawing.Color.Aqua;
            }

            else if (e.Row.Cells[6].Text == "WKG")
            {
                e.Row.BackColor = System.Drawing.Color.LightSkyBlue;
            }

            else if (e.Row.Cells[6].Text == "INSP")
            {
                e.Row.BackColor = System.Drawing.Color.Yellow;
            }

            else if (e.Row.Cells[6].Text == "BOB")
            {
                e.Row.BackColor = System.Drawing.Color.Lime;
            }

            else if (e.Row.Cells[6].Text == "On-Time")
            {
                e.Row.BackColor = System.Drawing.Color.SpringGreen;
            }
            else if (e.Row.Cells[6].Text == "MX-Delay")
            {
                e.Row.BackColor = System.Drawing.Color.Crimson;
            }

            if (e.Row.Cells[6].Text == "AOG")
            {
            e.Row.Cells[6].Text = "<FONT class='jqueryBlink'>" + e.Row.Cells[6].Text + "</FONT>";

        }

    }

Open in new window

0
Comment
Question by:BOEING39
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 19

Expert Comment

by:Albert Van Halen
ID: 39660469
Instead of putting a font tag with class in the text property of the cell, I would add a class to the row. Perhaps you can use
e.Row.CssClass="jqueryBlink"

Open in new window

After that it's up to jquery to capture the tablerows having the class and start blinking.

I created a fiddle for you : http://jsfiddle.net/j79kR/
0
 

Author Comment

by:BOEING39
ID: 39664819
This blinks all the row alternately.   I need code similar to that above for flashing (text) that blinks only rows meeting specific criteria without using css.   In the above examples it is utilizing "FONT" class.

For examplethe following code flashes the hyperlink column cell red/yellow based on MMCO-Open.   What I am looking for is for the entire row to blink based on a similar condition.

if (e.Row.Cells[12].Text == "MCO-Open" || e.Row.Cells[12].Text == "MMCO-Open")
        {
            HyperLink lnkMCO = (HyperLink)e.Row.Cells[1].Controls[0];
            lnkMCO.Text = "<FONT class='jqueryBlink'>" + lnkMCO.Text.ToString() + "</FONT>";
            //lnkMCO.ForeColor = Color.Red;
            lnkMCO.Style.Add("text-decoration", "none");
            e.Row.BackColor = System.Drawing.Color.Yellow;

Open in new window

0
 
LVL 19

Accepted Solution

by:
Albert Van Halen earned 2000 total points
ID: 39665183
In your code snippet you say that it blinks; it merely renders the rows' backgroundcolor to yellow.
If the table is updating via updatepanel it would indeed 'blink' after a partial postback. But then you don''t have to use jQuery because you render everything serverside.

I would suggest to use css rules to style the rows.

It's unclear to me what you want.
0
 

Author Closing Comment

by:BOEING39
ID: 39679656
Thanks
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question