Skip to content

Using countdown timer on gridview row

sunil kumar

Asked Apr 7, 2013, 3:02 AM EDT2 answers
Share
LinkedInX
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,

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Ashutosh Chaturvedi
    0
    HTML / XML
    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

    VB.NET
    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 Sub
    0
  • Ashutosh Chaturvedi
    0
    if it helped then pls make it as answered.
    0