BOEING39
asked on
GRIDVIEW CELL BLINKING BEHIND CODE
I have the following code example that I would like to insert into the attached code behind to make colum [2] blink based on the criteria in column [15] being either "MCO" or "MMCO". The below code sniplet is an example for a timestamp. Need assistance in applying to the attached code.
public void GridView1_RowDataBound(Obj ect sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow )
{
// cell[2] postion of column to BLINK, cell position based on criteria to BLINK = [15] when = "MCO" or "MMCO"
if (Convert.ToDateTime(e.Row. Cells[3].T ext) > DateTime.Now)
{
e.Row.Style.Add("text-deco ration", "blink");
e.Row.Style.Add("color", "red");
}
}
Home1All.aspx.cs
public void GridView1_RowDataBound(Obj
{
if (e.Row.RowType == DataControlRowType.DataRow
{
// cell[2] postion of column to BLINK, cell position based on criteria to BLINK = [15] when = "MCO" or "MMCO"
if (Convert.ToDateTime(e.Row.
{
e.Row.Style.Add("text-deco
e.Row.Style.Add("color", "red");
}
}
Home1All.aspx.cs
try this, have this script on your aspx page inorder to blink in IE.
Meeran03
//Cross browser function for blink process.
<script>
function blink() {
var blink = document.all.tags("BLINK");
for (var i = 0; i < blink.length; i++)
blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : ""
}
function startBlink() {
if (document.all)
setInterval("blink()", 1000)
}
window.onload = startBlink;
</script>
protected void gvData_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[15].Text == "MCO" || e.Row.Cells[15].Text == "MMCO" )
{
e.Row.Cells[2].Text = "<blink>" + e.Row.Cells[0].Text.ToString() + "</blink>";
e.Row.Cells[2].ForeColor = Color.Red;
e.Row.BackColor = System.Drawing.Color.Yellow;
}
}
}
Meeran03
ASKER
I have the timer script inserted into the Head and added the code behind; however, as the column associated with the blinking feature is actually 1 with the header MCO ORDER.
With the code modified as requested it still not blinking.
Home1All.aspx
Home1All.aspx.cs
With the code modified as requested it still not blinking.
Home1All.aspx
Home1All.aspx.cs
Try this,
if (e.Row.RowType == DataControlRowType.DataRow){
if (e.Row.Cells[15].Text == "AOG" || e.Row.Cells[15].Equals(DBNull.Value))
{
e.Row.BackColor = System.Drawing.Color.Red;
}
else if (e.Row.Cells[15].Text == "ETOPS - Working")
{
e.Row.BackColor = System.Drawing.Color.Yellow;
}
else if (e.Row.Cells[15].Text == "AOG - R/T")
{
e.Row.BackColor = System.Drawing.Color.Tomato;
}
else if (e.Row.Cells[15].Text == "High Priority")
{
e.Row.BackColor = System.Drawing.Color.LightSkyBlue;
}
else if (e.Row.Cells[15].Text == "SOS - Working")
{
e.Row.BackColor = System.Drawing.Color.Orange;
}
else if (e.Row.Cells[15].Text == "Working Spare")
{
e.Row.BackColor = System.Drawing.Color.Aquamarine;
}
else if (e.Row.Cells[15].Text == "AOG - Vendor")
{
e.Row.BackColor = System.Drawing.Color.Orange;
}
else if (e.Row.Cells[15].Text == "AOG-Sched/Work Required")
{
e.Row.BackColor = System.Drawing.Color.Crimson;
}
else if (e.Row.Cells[15].Text == "AOG-Sched/Work Elective")
{
e.Row.BackColor = System.Drawing.Color.Coral;
}
else if (e.Row.Cells[15].Text == "Alert ETOPS Fly Day")
{
e.Row.BackColor = System.Drawing.Color.Fuchsia;
}
else if (e.Row.Cells[15].Text == "Ready Spare")
{
e.Row.BackColor = System.Drawing.Color.Lime;
}
else if (e.Row.Cells[15].Text == "Ready Spare - A/C Hooked - WU-cw")
{
e.Row.BackColor = System.Drawing.Color.Lime;
}
else if (e.Row.Cells[15].Text == "Ready Spare - Needs WU ck")
{
e.Row.BackColor = System.Drawing.Color.Lime;
}
else if (e.Row.Cells[15].Text == "Ready Spare - A/C Hooked - Needs WU")
{
e.Row.BackColor = System.Drawing.Color.Lime;
}
else if (e.Row.Cells[15].Text == "Status Ready Spare - Needs WU-ck")
{
e.Row.BackColor = System.Drawing.Color.Lime;
}
if (e.Row.Cells[15].Text == "High Priority")
{
e.Row.Cells[15].ForeColor = Color.Red;
}
if (e.Row.Cells[15].Text == "Alert Requires Verification Flight")
{
e.Row.Cells[15].ForeColor = Color.White;
e.Row.BackColor = System.Drawing.Color.DarkRed;
}
if (e.Row.Cells[15].Text == "Alert Domestic Ops Only - Non Etops")
{
e.Row.Cells[15].ForeColor = Color.Red;
e.Row.BackColor = System.Drawing.Color.Gold;
}
if (e.Row.Cells[15].Text == "AOG Off Station Repairs")
{
e.Row.Cells[15].ForeColor = Color.Black;
e.Row.BackColor = System.Drawing.Color.Yellow;
}
if (e.Row.Cells[15].Text == "AOG - SSE ATA Category Item")
{
e.Row.Cells[15].ForeColor = Color.Black;
e.Row.BackColor = System.Drawing.Color.Pink;
}
if (e.Row.Cells[15].Text == "MMCO-Open")
{
e.Row.Cells[15].ForeColor = Color.Black;
e.Row.BackColor = System.Drawing.Color.Yellow;
}
if (e.Row.Cells[15].Text == "MCO-Open")
{
e.Row.Cells[15].ForeColor = Color.Black;
e.Row.BackColor = System.Drawing.Color.Yellow;
}
if (e.Row.Cells[15].Text == "Alert ETOPS Qualified")
{
e.Row.Cells[15].ForeColor = Color.Red;
e.Row.BackColor = System.Drawing.Color.Gold;
}
if (e.Row.Cells[15].Text == "MCO" || e.Row.Cells[15].Text == "MMCO")
{
HyperLink lnkMCO = (HyperLink)e.Row.Cells[1].Controls[0];
lnkMCO.Text = "<blink>" + lnkMCO.Text.ToString() + "</blink>";
lnkMCO.ForeColor = Color.Red;
lnkMCO.Style.Add("text-decoration", "none");
e.Row.BackColor = System.Drawing.Color.Yellow;
}
}
ASKER
Changed accordingly still not working.
public partial class _Home1All : System.Web.UI.Page
{
protected void GridView1_RowDataBound(obj ect sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow )
if (e.Row.Cells[15].Text == "AOG" || e.Row.Cells[15].Equals(DBN ull.Value) )
{
e.Row.BackColor = System.Drawing.Color.Red;
}
else if (e.Row.Cells[15].Text == "ETOPS - Working")
{
e.Row.BackColor = System.Drawing.Color.Yello w;
}
else if (e.Row.Cells[15].Text == "AOG - R/T")
{
e.Row.BackColor = System.Drawing.Color.Tomat o;
}
else if (e.Row.Cells[15].Text == "High Priority")
{
e.Row.BackColor = System.Drawing.Color.Light SkyBlue;
}
else if (e.Row.Cells[15].Text == "SOS - Working")
{
e.Row.BackColor = System.Drawing.Color.Orang e;
}
else if (e.Row.Cells[15].Text == "Working Spare")
{
e.Row.BackColor = System.Drawing.Color.Aquam arine;
}
else if (e.Row.Cells[15].Text == "AOG - Vendor")
{
e.Row.BackColor = System.Drawing.Color.Orang e;
}
else if (e.Row.Cells[15].Text == "AOG-Sched/Work Required")
{
e.Row.BackColor = System.Drawing.Color.Crims on;
}
else if (e.Row.Cells[15].Text == "AOG-Sched/Work Elective")
{
e.Row.BackColor = System.Drawing.Color.Coral ;
}
else if (e.Row.Cells[15].Text == "Alert ETOPS Fly Day")
{
e.Row.BackColor = System.Drawing.Color.Fuchs ia;
}
else if (e.Row.Cells[15].Text == "Ready Spare")
{
e.Row.BackColor = System.Drawing.Color.Lime;
}
else if (e.Row.Cells[15].Text == "Ready Spare - A/C Hooked - WU-cw")
{
e.Row.BackColor = System.Drawing.Color.Lime;
}
else if (e.Row.Cells[15].Text == "Ready Spare - Needs WU ck")
{
e.Row.BackColor = System.Drawing.Color.Lime;
}
else if (e.Row.Cells[15].Text == "Ready Spare - A/C Hooked - Needs WU")
{
e.Row.BackColor = System.Drawing.Color.Lime;
}
else if (e.Row.Cells[15].Text == "Status Ready Spare - Needs WU-ck")
{
e.Row.BackColor = System.Drawing.Color.Lime;
}
if (e.Row.Cells[15].Text == "High Priority")
{
e.Row.Cells[15].ForeColor = Color.Red;
}
if (e.Row.Cells[15].Text == "Alert Requires Verification Flight")
{
e.Row.Cells[15].ForeColor = Color.White;
e.Row.BackColor = System.Drawing.Color.DarkR ed;
}
if (e.Row.Cells[15].Text == "Alert Domestic Ops Only - Non Etops")
{
e.Row.Cells[15].ForeColor = Color.Red;
e.Row.BackColor = System.Drawing.Color.Gold;
}
if (e.Row.Cells[15].Text == "AOG Off Station Repairs")
{
e.Row.Cells[15].ForeColor = Color.Black;
e.Row.BackColor = System.Drawing.Color.Yello w;
}
if (e.Row.Cells[15].Text == "AOG - SSE ATA Category Item")
{
e.Row.Cells[15].ForeColor = Color.Black;
e.Row.BackColor = System.Drawing.Color.Pink;
}
if (e.Row.Cells[15].Text == "MMCO-Open")
{
e.Row.Cells[15].ForeColor = Color.Black;
e.Row.BackColor = System.Drawing.Color.Yello w;
}
if (e.Row.Cells[15].Text == "MCO-Open")
{
e.Row.Cells[15].ForeColor = Color.Black;
e.Row.BackColor = System.Drawing.Color.Yello w;
}
if (e.Row.Cells[15].Text == "Alert ETOPS Qualified")
{
e.Row.Cells[15].ForeColor = Color.Red;
e.Row.BackColor = System.Drawing.Color.Gold;
}
if (e.Row.Cells[15].Text == "MCO" || e.Row.Cells[15].Text == "MMCO")
{
HyperLink lnkMCO = (HyperLink)e.Row.Cells[1]. Controls[0 ];
lnkMCO.Text = "<blink>" + lnkMCO.Text.ToString() + "</blink>";
lnkMCO.ForeColor = Color.Red;
lnkMCO.Style.Add("text-dec oration", "none");
e.Row.BackColor = System.Drawing.Color.Yello w;
}
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Clear();
Response.Buffer = true;
Response.AddHeader("conten t-disposit ion",
"attachment;filename=GridV iewExport. doc");
Response.Charset = "";
Response.ContentType = "application/vnd.ms-word ";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
GridView1.AllowPaging = false;
GridView1.RenderControl(hw );
Response.Output.Write(sw.T oString()) ;
Response.Flush();
Response.End();
}
public override void VerifyRenderingInServerFor m(Control control)
{
}
}
public partial class _Home1All : System.Web.UI.Page
{
protected void GridView1_RowDataBound(obj
{
if (e.Row.RowType == DataControlRowType.DataRow
if (e.Row.Cells[15].Text == "AOG" || e.Row.Cells[15].Equals(DBN
{
e.Row.BackColor = System.Drawing.Color.Red;
}
else if (e.Row.Cells[15].Text == "ETOPS - Working")
{
e.Row.BackColor = System.Drawing.Color.Yello
}
else if (e.Row.Cells[15].Text == "AOG - R/T")
{
e.Row.BackColor = System.Drawing.Color.Tomat
}
else if (e.Row.Cells[15].Text == "High Priority")
{
e.Row.BackColor = System.Drawing.Color.Light
}
else if (e.Row.Cells[15].Text == "SOS - Working")
{
e.Row.BackColor = System.Drawing.Color.Orang
}
else if (e.Row.Cells[15].Text == "Working Spare")
{
e.Row.BackColor = System.Drawing.Color.Aquam
}
else if (e.Row.Cells[15].Text == "AOG - Vendor")
{
e.Row.BackColor = System.Drawing.Color.Orang
}
else if (e.Row.Cells[15].Text == "AOG-Sched/Work Required")
{
e.Row.BackColor = System.Drawing.Color.Crims
}
else if (e.Row.Cells[15].Text == "AOG-Sched/Work Elective")
{
e.Row.BackColor = System.Drawing.Color.Coral
}
else if (e.Row.Cells[15].Text == "Alert ETOPS Fly Day")
{
e.Row.BackColor = System.Drawing.Color.Fuchs
}
else if (e.Row.Cells[15].Text == "Ready Spare")
{
e.Row.BackColor = System.Drawing.Color.Lime;
}
else if (e.Row.Cells[15].Text == "Ready Spare - A/C Hooked - WU-cw")
{
e.Row.BackColor = System.Drawing.Color.Lime;
}
else if (e.Row.Cells[15].Text == "Ready Spare - Needs WU ck")
{
e.Row.BackColor = System.Drawing.Color.Lime;
}
else if (e.Row.Cells[15].Text == "Ready Spare - A/C Hooked - Needs WU")
{
e.Row.BackColor = System.Drawing.Color.Lime;
}
else if (e.Row.Cells[15].Text == "Status Ready Spare - Needs WU-ck")
{
e.Row.BackColor = System.Drawing.Color.Lime;
}
if (e.Row.Cells[15].Text == "High Priority")
{
e.Row.Cells[15].ForeColor = Color.Red;
}
if (e.Row.Cells[15].Text == "Alert Requires Verification Flight")
{
e.Row.Cells[15].ForeColor = Color.White;
e.Row.BackColor = System.Drawing.Color.DarkR
}
if (e.Row.Cells[15].Text == "Alert Domestic Ops Only - Non Etops")
{
e.Row.Cells[15].ForeColor = Color.Red;
e.Row.BackColor = System.Drawing.Color.Gold;
}
if (e.Row.Cells[15].Text == "AOG Off Station Repairs")
{
e.Row.Cells[15].ForeColor = Color.Black;
e.Row.BackColor = System.Drawing.Color.Yello
}
if (e.Row.Cells[15].Text == "AOG - SSE ATA Category Item")
{
e.Row.Cells[15].ForeColor = Color.Black;
e.Row.BackColor = System.Drawing.Color.Pink;
}
if (e.Row.Cells[15].Text == "MMCO-Open")
{
e.Row.Cells[15].ForeColor = Color.Black;
e.Row.BackColor = System.Drawing.Color.Yello
}
if (e.Row.Cells[15].Text == "MCO-Open")
{
e.Row.Cells[15].ForeColor = Color.Black;
e.Row.BackColor = System.Drawing.Color.Yello
}
if (e.Row.Cells[15].Text == "Alert ETOPS Qualified")
{
e.Row.Cells[15].ForeColor = Color.Red;
e.Row.BackColor = System.Drawing.Color.Gold;
}
if (e.Row.Cells[15].Text == "MCO" || e.Row.Cells[15].Text == "MMCO")
{
HyperLink lnkMCO = (HyperLink)e.Row.Cells[1].
lnkMCO.Text = "<blink>" + lnkMCO.Text.ToString() + "</blink>";
lnkMCO.ForeColor = Color.Red;
lnkMCO.Style.Add("text-dec
e.Row.BackColor = System.Drawing.Color.Yello
}
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Clear();
Response.Buffer = true;
Response.AddHeader("conten
"attachment;filename=GridV
Response.Charset = "";
Response.ContentType = "application/vnd.ms-word ";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
GridView1.AllowPaging = false;
GridView1.RenderControl(hw
Response.Output.Write(sw.T
Response.Flush();
Response.End();
}
public override void VerifyRenderingInServerFor
{
}
}
check whether your recieving MCO OR MMCO with upper case on cell15 do a debug and test whether its processing inside d loop of d above condition .
ASKER
Ok I got it working. It is not applying fore color of "Red" however. Would it be difficult to make the entire background color Blink or alternate colors?? Trying to bring as much attention to this information as possible.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Works great. Thx so much for your assistance. It's been a please
ASKER
Excellant response time with accurate information easy to understand. Thx so much.
Thank u for the grade and appreciation .
Meeran03
Meeran03
Is this what you are looking for?
if (e.Row.Cells[15].Text == "MCO" || e.Row.Cells[15].Text == "MMCO")
{
e.Row.Cells[2].Style.Add("
e.Row.Cells[2].Style.Add("