Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET CSS SQL-Server
How to Blink a LABEL in Asp.net for every 5 minutes.
=======================================================
 
Dear Friends,
 
I have a Label...This label is set as Date on my webform.
 
It must BLINK for every 5 minutes.....it should blink for just 10 seconds and go.
 
Please can u show me, how to do this.
 
Thanks in Advance.
Posted 18-Jun-12 20:44pm
Comments
Sergey Alexandrovich Kryukov at 19-Jun-12 3:10am
   
This is quite possible, but -- do yourself a favor, don't do it. What to irritate your users?
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi
 
try this
<body onload="changeColour('flashtext');">
 
<script type="text/javascript">
 
function changeColour(elementId) {
    var interval = 1000;
    var colour1 = "#ff0000"
    var colour2 = "#000000";
    if (document.getElementById) {
        var element = document.getElementById(elementId);
        element.style.color = (element.style.color == colour1) ? colour2 : colour1;
        setTimeout("changeColour('" + elementId + "')", interval);
    }
}
 
</script>
 
<p id="flashtext">This text will flash!!!</p>
 
Hope this will Help u
Best Luck
  Permalink  
Comments
Ubaid ur Rahman IT at 19-Jun-12 3:06am
   
Boss !!
 
Listen to me, I need like this ??
 
Design Page
===========
Label -> LabelId - lblmessage
 
Code behind page
=================
Page_load
 
lblMessage.Text = "Last Updated at : " + DateTime.Now.AddMinutes(-60).ToLongTimeString();
 

Just I need to blink the time for every 5 minutes....This label should blink only 10 seconds and go.
 

Thanks Please help me.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi Ubaid,
Reference System.Threading, add an AJAX timer control and a ScriptManager to your aspx page.
 
<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
 
    <asp:timer runat="server" ID="tmr1" Interval="300000" ontick="tmr1_Tick"></asp:timer>
    <h1><asp:Label Text="" ID="lblTestTimer" runat="server"></asp:Label></h1>
in timer_tick event put the following codes:
protected void tmr1_Tick(object sender, EventArgs e)
        {
            lblTestTimer.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt");
            lblTestTimer.Visible = true;
            Thread.Sleep(10000);
            lblTestTimer.Visible = false;
            
        }
 

This will do the trick what you want...Cheers !!
 
Happy Coding Smile | :)
Sunny_K
  Permalink  
v2
Comments
Sunnykumar08 at 19-Jun-12 4:39am
   
Thanks for voting my answer. please don't forget to accept as answer if it helped you achieving the purpose.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 310
1 Sergey Alexandrovich Kryukov 176
2 PhilLenoir 164
3 Richard MacCutchan 160
4 Sharmanuj 156
0 Sergey Alexandrovich Kryukov 6,081
1 OriginalGriff 5,115
2 CPallini 2,473
3 Richard MacCutchan 1,597
4 Abhinav S 1,505


Advertise | Privacy | Mobile
Web01 | 2.8.140814.1 | Last Updated 19 Jun 2012
Copyright © CodeProject, 1999-2014
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