2014年7月13日 星期日

[RESOLVED] How to create time countdown in datalist or gridview


Hi, I'm trying to make public auction list. And I need time countdown for every row in datalist or gridview. How do I create time countdown in datalist or gridview using Asp.Net/C#?




Have a look at this link,


How to display a timer countdown inside my Gridview:

http://forums.asp.net/t/1743407.aspx/1



Thanks sridhar_rs. I solved my problem.


.aspx




























codebehind


protected void Timer1_Tick(object sender, EventArgs e)
{

foreach (GridViewRow item in GridView1.Rows)
{
var label2 = item.FindControl("Label2") as Label;

var label3 = item.FindControl("Label3") as Label;
var time2 = DateTime.Parse(label3.Text);
label.Text = (time2 - DateTime.Now).Days + " Day " + (time2 - DateTime.Now).Hours + " Hours " + (time2 - DateTime.Now).Minutes + " Minutes " + (time2 - DateTime.Now).Seconds + " Seconds";
}

}




沒有留言:

張貼留言