Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 1.28 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Timer countdown sql, asp.net c#, javascript
  2. <script language="JavaScript">
  3.   TargetDate = "12/31/2020 5:00 AM";
  4.   BackColor = "palegreen";
  5.   ForeColor = "navy";
  6.   CountActive = true;
  7.   CountStepper = -1;
  8.   LeadingZero = true;
  9.   DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
  10.   FinishMessage = "the auction end"
  11.   </script>
  12.    <script language="JavaScript" src="countdown.js"></script>
  13.        
  14. <script language="JavaScript">
  15.   TargetDate = "<% = TargetDate %>"; /*this is a property in code behind*/
  16.   BackColor = "palegreen";
  17.   ForeColor = "navy";
  18.   CountActive = true;
  19.   CountStepper = -1;
  20.   LeadingZero = true;
  21.   DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
  22.   FinishMessage = "the auction end"
  23. </script>
  24. <script language="JavaScript" src="countdown.js"></script>
  25.  
  26.  
  27. Page code behind:
  28.  
  29. public string TargetDate{
  30.   // Build code to get date from database
  31.   string sql = "SELECT targetDate from Events where Event_ID = 1309";
  32.   // execute sql
  33.   // ...
  34.   return dbvalue;
  35. }
  36.        
  37. Javascript
  38.        
  39. ClientScript.RegisterClientScriptBlock(this.GetType(),
  40.                                        "AuctionTargetDateScript",
  41.                                        string.Format("TargetDate = '{0}';", TargetDateFromDB),
  42.                                        true);