Hi,
I want to use a Count Down Timer at grid view rows like Help Desk Project. But I don't know how do it.
When The time is over basically label color will be changed as according. Have I use Multiple Timer or a Single timer for this task ?
Please anybody give your evaluable replies.
Thanks,
Using countdown timer on gridview row
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Ashutosh Chaturvedi87 pointsPosted Apr 9, 2013, 8:15 AM EDT
hi Here is demo code u can use it and manipulate vb code to C# may it will help. <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </div> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:ImageButton ID="ImageButton1" runat="server" /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> <asp:Timer ID="Timer1" runat="server" Interval="1000"> </asp:Timer> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="RowCommand" /> <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /> </Triggers> </asp:UpdatePanel>Code-Behind
Dim lst As New List(Of String) Protected Sub GridView1_RowCommand(sender As Object, e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand Label1.Text = DateTime.Now End Sub Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then If IsNothing(Session("lst")) Then Session("lst") = lst End If GridView1.DataSource = lst GridView1.DataBind() End If End Sub Protected Sub Timer1_Tick(sender As Object, e As System.EventArgs) Handles Timer1.Tick lst = Session("lst") lst.Add(DateTime.Now.ToString()) GridView1.DataSource = lst GridView1.DataBind() End SubAshutosh Chaturvedi87 pointsPosted Apr 9, 2013, 8:15 AM EDT