Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In gridview, i want countdown timer in javascript.

Please Help me with this.
Posted
Comments
syed shanu 1-Dec-14 1:23am    
can you post you code here and what did you try so far.
syed shanu 1-Dec-14 1:28am    
Check this link for javascript count down .
Now you have to place this in your gridview.
http://www.codeproject.com/Questions/260124/Countdown-timer-in-asp-net
Gokul Athithan 1-Dec-14 1:56am    
<script>
$(document).ready(function () {

var rows = document.getElementById("<%=dgLiveAuctionBid.ClientID %>").getElementsByTagName("tr");
var message = "";
for (var i = 1; i < rows.length; i++) {
var kkk = GetChildControl(rows[i], "Label2");
var jjj = GetChildControl(rows[i], "defaultCountdown");

var austDay = new Date();
austDay = new Date(2014, 11, 29, 18, 0, 0, 0);
$(jjj).countdown({ until: austDay });
$(kkk).text(austDay.getFullYear());
}
//alert(message);
//return false;
});
//On UpdatePanel Refresh
var prm = Sys.WebForms.PageRequestManager.getInstance();

prm.add_endRequest(function () {

var rows = document.getElementById("<%=dgLiveAuctionBid.ClientID %>").getElementsByTagName("tr");
var message = "";
for (var i = 1; i < rows.length; i++) {
var kkk = GetChildControl(rows[i], "Label2");
var jjj = GetChildControl(rows[i], "defaultCountdown");

var austDay = new Date();
austDay = new Date(2014, 11, 29, 18, 0, 0, 0);
$(jjj).countdown({ until: austDay });
$(kkk).text(austDay.getFullYear());
}
}
);

</script>

<itemtemplate>
<span></span>
<asp:Label ID="lblAuctionDate" runat="server" Font-Bold="true" Text='<%#Bind("OnlineAuctionDate") %>' Visible="True">
<br />
<span>To  </span><br /><asp:Label ID="lblAuctionTime" runat="server" Font-Bold="true" Text='<%#Bind("EndTime") %>'>
 
<br />


<asp:Label ID="Label2" runat="server" Text="20">
<div id="defaultCountdown" runat="server"></div>


Marcin Kozub 2-Dec-14 2:49am    
You should update your question with your code instead pasting it into comments, and use code formatting...

check
http://flipclockjs.com/[^]
http://www.gieson.com/Library/projects/utilities/countdown/[^]
http://www.java-scripts.net/javascripts/Countdown-Timer.phtml[^]

if you need to integrate js countdown in asp.net gridview you need to provide more information on what are the data you already showing in the grid, based on which column data you going to start count down, whcih column you going to show the count down, who the initial value stored ( date or date and time) etc..
you can assign css classes for both initial value column and count down showing label column and then you can select those using jquery class selector and do the rest.
 
Share this answer
 
v2
Just By getting values of EndTime in the Database assign in to the javascript end time
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900