?
Solved

Blink Gridview Row  Color - Utilizing J-Query

Posted on 2013-11-18
4
Medium Priority
?
646 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
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…
Suggested Courses

801 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