Protected Sub OnlineTest(ByVal sender As Object, ByVal e As EventArgs)
'Get the reference of the clicked button.
Dim kodeKategori As LinkButton = CType(sender, LinkButton)
'Get the command argument
Dim commandArgument As String = kodeKategori.CommandArgument
kode_kategori = commandArgument
myConnection = New SqlConnection(WebConfigurationManager.ConnectionStrings("conn").ConnectionString)
myConnection.Open()
sqlString = "select nama_kategori, waktu from m_kategori" & Chr(10)
sqlString = sqlString & "where kode_kategori = " & kode_kategori
myCommand = New SqlCommand(sqlString, myConnection)
myCommand.CommandTimeout = 0
myReader = myCommand.ExecuteReader()
If myReader.Read = True Then
lblKategori.Text = "Kategori : " & myReader("nama_kategori").ToString
Dim waktu_habis As Double = myReader("waktu").ToString * 60
TimeAllSecondes = waktu_habis
End If
con.Close()
plhPilihan.Visible = False
plhTest.Visible = True
Call BindTest()
End Sub
Protected Sub GetTime(sender As Object, e As EventArgs)
If TimeAllSecondes > 0 Then
TimeAllSecondes = TimeAllSecondes - 1
Else
plhPilihan.Visible = True
plhTest.Visible = False
End If
Dim time_Span As TimeSpan = TimeSpan.FromSeconds(TimeAllSecondes)
hh = time_Span.Hours
mm = time_Span.Minutes
ss = time_Span.Seconds
lblWaktu.Text = " " & hh & ":" & mm & ":" & ss
End Sub
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<p>
Sisa Waktu :
<asp:Label ID="lblWaktu" runat="server" Text=""></asp:Label></p>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" />
</Triggers>
</asp:UpdatePanel>
<asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="GetTime">
</asp:Timer>
After I tried the script that was given and still not suitable, finally I got a way of displaying the time that suits my needs.
Thanks for pandeyism for your help.