Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 29th, 2009, 01:25 AM
Authorized User
 
Join Date: Jun 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Blinking rows of a gridview on some condition

Dear Friends,
I'm working on a .NET web application wherein I have a gridview. The gridview gets refreshed after some time interval that is specified by user.
Now there is a Time column in the gridview which contains a number (in minutes). This column is invisible. The requirement is for the rows of a gridview to blink if the Time column for those rows has a value less than 120. So all the rows in the grid where the Time column has value < 120 should blink.
So let's say the first time when the page loads only the first five rows of the gridview are blinking (since they satisfy the above condition). Now after the gridview gets refreshed, two more rows get added from the DB and they satisfy the condition above. So in this case, the previous five rows plus the two new rows (7 in total) should blink.
I tried all sorts of javascript function but coudln't achieve this requirement. Can someone help me out with this??
Thanks in advance
Debsoft
__________________
cheers,
debsoft
 
Old August 1st, 2009, 03:05 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Don't think I've ever seen a blimking row before.

What do you mean when you say a row should "blink"? Do you meant just the background should blink, or the actual data and everything?
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old August 2nd, 2009, 10:58 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default You could...

I'm just assuming here but you could do something like this

Use javascript to perform the actual blinking.
Code:
window.onload = startBlink;

function doBlink() {
  // Blink, Blink, Blink...
  var blink = document.all.tags("BLINK")
  for (var i=0; i < blink.length; i++)
    blink[i].style.color = blink[i].style.color == "" ? "white" : "" 
}

function startBlink() {
  // Make sure it is IE4
  if (document.all)
    setInterval("doBlink()",1000)
}
then just add <BLINK></BLINK> tags around the Data you want to blink

So in your gridview you could do something like
Code:
        <asp:TemplateField HeaderText = "First Data Column">
        <ItemTemplate>
        <%= iif(cint(Eval("Time")) < 120,"<BLINK>" & Eval("FirstDataColumn").ToString & "</BLINK>", Eval("FirstDataColumn").ToString  %>
        </ItemTemplate>
        </asp:TemplateField>
        
        <asp:TemplateField HeaderText = "Second Data Column">
        <ItemTemplate>
        <%= iif(cint(Eval("Time")) < 120,"<BLINK>" & Eval("SecondDataColumn").ToString & "</BLINK>", Eval("SecondDataColumn").ToString  %>
        </ItemTemplate>
        </asp:TemplateField>
There may be better ways to do this but i'm just doing an inline if to see if the time is less than 120 if it is then i add the BLINK tags around the text value and if it's not then i just add the text value. Now this won't work if you need to edit the gridview but it's just readonly then I think it might work for what you need?
__________________
Jason Hall

Follow me on Twitter @jhall2013
 
Old August 2nd, 2009, 11:23 AM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Jason -- you have the right idea, but using the <BLINK> tag wouldn't be cross-browser compatible. No version of IE has ever supported it.

I think you'd have to do this through CSS, by switching the visibility property from visible to hidden using a javascript timer as you've done.

Or better yet, what I would do is probably leave the data visible but just blink the background color of the row using the background property. This would allow the data to still be readable, but would accomplish the intended function of bringing attention to the rows in question.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old August 2nd, 2009, 02:25 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default

Hmm... i've used that code for a while and it does work in IE (IE6+ at least). Either way the concept should be the same so how ever they want to do it should accomplish the task. Thanks for the alternative Lee!
__________________
Jason Hall

Follow me on Twitter @jhall2013
 
Old August 2nd, 2009, 02:38 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

I assure you, the <blink> tag has never, ever worked in any version of Internet Explorer.

http://en.wikipedia.org/wiki/Blink_element

Apple Safari does not support it either.

It is supported by FireFox and Opera.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old August 2nd, 2009, 02:46 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default ahh...

I see what you are saying... I'm not expecting the tag to do the blinking i'm just using that tag to denote what you want to blink. I use the doBlink function just to find the blink tag instead of sending the id of what ever you want to blink. But yes you are right the "blink" tag doesn't work. I just use it as a locator for what i want to blink. I guess your way would be less confusing...
__________________
Jason Hall

Follow me on Twitter @jhall2013
 
Old August 2nd, 2009, 02:50 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Oh right, I get you. That would work then.

I'd also point out that it still wouldn't validate (blink is not standards compliant) if that is important to you.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}





Similar Threads
Thread Thread Starter Forum Replies Last Post
Editing all GridView rows Abbas ASP.NET 2.0 Professional 4 March 3rd, 2012 02:19 PM
Gridview and inserting rows thewoodchuck BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 0 April 10th, 2008 09:55 AM
Highlight specific rows in a gridview rao965 ASP.NET 2.0 Professional 6 June 14th, 2007 03:20 AM
Editing all GridView rows Abbas C# 2005 0 November 29th, 2006 03:52 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.