shirleyz8821
asked on
asp.net How to blink/flash a lable based on the status of database data
I want to refresh page every 15 seconds and dispaly total amount based on the data (Total Amount from database). If Total amount is greater than 10000, The amount lable will display amount with blink/flash otherwise just display label text no flush. Please advise how to make this work. See below code. Very appreciated with your help. I am using IE8 with .net 4.0
asp.net UpdatePanel
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="Main Content">
<asp:ScriptManager runat="server" id="ScriptManager1">
</asp:ScriptManager>
<asp:UpdatePanel runat="server" id="UpdatePanel1">
<ContentTemplate>
<asp:Timer runat="server" id="Timer1" Interval="15000" OnTick="Timer1_Tick"></asp :Timer>
<asp:Label runat="server" id="lblAmt" Text="" ForeColor="White"></asp:La bel>
<br />
<asp:Label runat="server" ForeColor="White" Font-Size="Medium" Text="Page not refreshed yet." id="lblTime"
></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
C# code-behind
DisplayService eService = new DisplayService(Constants.C onnections .Display_D B);
Decimal _TotalAmt;
bool _DisplayStatus
private Decimal TotalAmt
{
get { return _BTotalAmt; }
set { _TotalAmt = value; }
}
private bool DisplayStatus
{
get { return _DisplayStatus; }
set { _DisplayStatus = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
DisplayEntity entry = eService.GetRunningTotal() ;
TotalAmt = entry .RunningTotalAmt;
if (TotalAmt >= 10000)
DisplayStatus = true;
}
protected void Timer1_Tick(object sender, EventArgs e)
{
lblTime.Text = "Panel refreshed at: " + DateTime.Now.ToString();
lblAmt.Text = "<big><big><big><big>$" + Convert.ToDecimal(TotalAmt ) + "</big></big></big></big>" ;
if (DisplayStatus )
{
// question here, to be done???
how to make the lblAmt.Text blink and flash with different color
}
}
asp.net UpdatePanel
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="Main
<asp:ScriptManager runat="server" id="ScriptManager1">
</asp:ScriptManager>
<asp:UpdatePanel runat="server" id="UpdatePanel1">
<ContentTemplate>
<asp:Timer runat="server" id="Timer1" Interval="15000" OnTick="Timer1_Tick"></asp
<asp:Label runat="server" id="lblAmt" Text="" ForeColor="White"></asp:La
<br />
<asp:Label runat="server" ForeColor="White" Font-Size="Medium" Text="Page not refreshed yet." id="lblTime"
></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
C# code-behind
DisplayService eService = new DisplayService(Constants.C
Decimal _TotalAmt;
bool _DisplayStatus
private Decimal TotalAmt
{
get { return _BTotalAmt; }
set { _TotalAmt = value; }
}
private bool DisplayStatus
{
get { return _DisplayStatus; }
set { _DisplayStatus = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
DisplayEntity entry = eService.GetRunningTotal()
TotalAmt = entry .RunningTotalAmt;
if (TotalAmt >= 10000)
DisplayStatus = true;
}
protected void Timer1_Tick(object sender, EventArgs e)
{
lblTime.Text = "Panel refreshed at: " + DateTime.Now.ToString();
lblAmt.Text = "<big><big><big><big>$" + Convert.ToDecimal(TotalAmt
if (DisplayStatus )
{
// question here, to be done???
how to make the lblAmt.Text blink and flash with different color
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.