You must Sign In to post a response.
Category: ASP.NET
#765899
you can try bellow code ...
Call this java script function on OnClientClick of button which sets the time on label "lblTime"
<script type="text/javascript">
function showtime() {
setInterval(setTime, 1000);
var lbl = document.getElementById('<%= lblTime.ClientID %>');
var i = 0;
function setTime() {
lbl.innerHTML = i + ' Seconds';
i++;
}
}
</script>
protected void Button1_Click(object sender, EventArgs e)
{
//System.Threading.Thread.Sleep(1000);
System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
watch.Start();
//System.Threading.Thread.Sleep(3000); //sleeps for 3 seconds
// Your code..
watch.Stop();
lblTime.Text = watch.Elapsed.Seconds + " Seconds";
}
Call this java script function on OnClientClick of button which sets the time on label "lblTime"
<script type="text/javascript">
function showtime() {
setInterval(setTime, 1000);
var lbl = document.getElementById('<%= lblTime.ClientID %>');
var i = 0;
function setTime() {
lbl.innerHTML = i + ' Seconds';
i++;
}
}
</script>
protected void Button1_Click(object sender, EventArgs e)
{
//System.Threading.Thread.Sleep(1000);
System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
watch.Start();
//System.Threading.Thread.Sleep(3000); //sleeps for 3 seconds
// Your code..
watch.Stop();
lblTime.Text = watch.Elapsed.Seconds + " Seconds";
}
Return to Return to Discussion Forum