?
Solved

Timer Asp.Net

Posted on 2012-08-21
9
Medium Priority
?
487 Views
Last Modified: 2012-09-26
I want to update Time every second without page Load and Without using Javascript and Jquery or Ajax
0
Comment
Question by:fxcentral
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 9

Expert Comment

by:teebon
ID: 38319164
You may choose to embed a Flash or Silverlight clock

http://www.c-sharpcorner.com/uploadfile/nipuntomar/silverlight-clock/
0
 

Author Comment

by:fxcentral
ID: 38319232
Is there any possibilities by using Asp.Net Alone,  without using Silverlight and Adobe Flash
0
 
LVL 26

Expert Comment

by:Alan Warren
ID: 38319244
Hi fxcentral,

You could create a small standalone page that has a timer wired up to increment a timeLabel.text. Then you put the standalone page in an iFrame on your main page, onload won't trigger for the parent page.

Alan ";0)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:fxcentral
ID: 38319287
can i have some  tutorial link for Iframe
0
 
LVL 26

Expert Comment

by:Alan Warren
ID: 38319299
Hi fxcentral,

timer.aspx:
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  Protected Sub Timer1_Tick(sender As Object, e As System.EventArgs)
    Me.Label1.Text = DateAndTime.TimeString
  End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body style="width:100px;height:20px; margin:0;">
  <form id="form1" runat="server">
    <div>
      <asp:ScriptManager ID="ScriptManager1" runat="server" />
      <asp:Timer runat="server" id="Timer1" Interval="1000" ontick="Timer1_Tick" />
      <asp:Label ID="Label1" runat="server" Text="" />
    </div>
  </form>
</body>
</html>

Open in new window

main-page.aspx
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
  Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    Me.Label1.Text = "Page_Load Fired: " & DateAndTime.TimeString
  End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:Label ID="Label1" runat="server" Text="" />
      <br />
      <iframe ID='TimerFrame' src="timer.aspx"  frameborder="0" width='100' height='20' scrolling="no" runat='server'></iframe>  
    </div>
    </form>
</body>
</html>

Open in new window

Alan ";0)
0
 

Author Comment

by:fxcentral
ID: 38319317
I was not supose to use ajax
0
 
LVL 9

Expert Comment

by:teebon
ID: 38319353
print datetime from ASP.NET code behind, then use meta tag on the HTML to refresh the page every second:

<html>
<head>
<meta http-equiv="refresh" content="1" />
</head>
<body>
<center>
<p><%Response.Write(now())%></p>
</center>
</body>
</html>

Open in new window

0
 
LVL 26

Accepted Solution

by:
Alan Warren earned 1500 total points
ID: 38319384
A ScriptManager hardly qualifies as ajax, it's a standard asp .net component these days.

I don't have a reference to Ajax in the App I tested the samples provided.

The ASP.NET UpdatePanel, UpdateProgress, and Timer controls require a ScriptManager control in order to support partial-page rendering.

Historically, yes a ScriptManager was an Ajax component, I guess it still is, but it's also now an ASP .Net component, right out of the box.

Other than that, I'd have to say, to the best of my knowledge, given the constraints of your request, this is not doable.

There is page here http://apps.eky.hk/css3clock/ that claims to provide a Pure CSS3 clock, but if you view the source, there's a lot of javascript.

Alan
0
 
LVL 19

Expert Comment

by:Amandeep Singh Bhullar
ID: 38319447
I have one idea to do this, but not sure will it work for you

you can do it as
In the main page add a iframe, in iframe give link of another page which has a time to display.
In the target page add the meta tag to refresh page every second.

I have attached the sample code for reference :)

Hope this will khelp you......
Timer.zip
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Loops Section Overview
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question