CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 7/3/2007 6:50:15 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 4 Views: 17 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
5 Items, 1 Pages 1 |< << Go >> >|
Themlruts
Asp.Net User
date and time7/3/2007 6:50:15 PM

0/0

I want to add date and time on my master page.  I can do it with the

TextBox1.Text = DateTime.Now.ToString()

But i want it to be able to update  every sec

Mike

XIII
Asp.Net User
Re: date and time7/3/2007 7:38:07 PM

0/0

Hi,

Themlruts:
But i want it to be able to update  every sec

If you want to update it every second you can use javascript to update it only on the client side. There are plenty enough scripts enough to find through google/live.com If you want to update something server side every second you could use the Timer control that comes with ASP.NET AJAX: http://ajax.asp.net/docs/overview/UsingTimerControlTutorial.aspx.

Grz, Kris.


Kris van der Mast [MVP] || 101 LINQ to SQL samples
willydavidjr
Asp.Net User
Re: date and time7/4/2007 6:34:16 AM

0/0

Try this one, it's like having a timer on your page. Just put an updatepanel and put a label and a timer inside it. Set the timer at 1000 equivalent to one second, and set the timer event.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Untitled Page</title>

</head>

<body>

<form id="form1" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server" />

<div>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">

<ContentTemplate>

<asp:Timer ID="myTimer" runat="server" Interval="1000" OnTick="myTimer_Tick"></asp:Timer>

<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><br />

</ContentTemplate>

</asp:UpdatePanel>

</div>

</form>

</body>

</html>

 

Event for timer:

protected void myTimer_Tick(object sender, EventArgs e)

{

Label1.Text =
DateTime.Now.ToString();

}

 

Hope that helps!

 


Willy David Jr

5th Year Bachelor of Technology Major in Information Technology Student - TUP

Software Engineering Technologist

Programming is a Passion, Software Development is an Adventure - willydavidjr
Themlruts
Asp.Net User
Re: date and time7/5/2007 7:37:34 PM

0/0

The problem is taht you are using ajax for that.  I cant use ajax were i am is there any other way? Java maby  it is fine if its client side

Mike

Amanda Wang - M
Asp.Net User
Re: date and time7/6/2007 10:25:20 AM

0/0

Hi Mike,

You can use javascript, below is my test code, hopt it can help you:

 

<script language="javascript" type="text/javascript">
function tick() 
{
   var today;
   today = new Date();
 
   LocalTime.innerHTML = showLocale(today);

   window.setTimeout("tick()", 1000);
   
  
}

function showLocale(objD) 
{
   
   var dn,s;
   var hh = objD.getHours();
   
   var mm = objD.getMinutes();
   var ss = objD.getSeconds();
   
   s = objD.getFullYear() + "Year" + (objD.getMonth() + 1) + "Month" + objD.getDate() +"Day ("+ objD.getDay() +")";

   if(hh>12) { hh = hh-12; dn = 'morning'; }
   else dn = 'afternoon';

   if(hh<10) hh ='0' + hh;
   if(mm<10) mm ='0' + mm;
   if(ss<10) ss ='0' + ss;

   s +=" " + dn + ' ' + hh + ":" + mm + ":" + ss;
   return(s);
}
head>
<body onload="tick()" >
    <form id="form1" runat="server" >
    <div>
    <SPAN id="LocalTime" style="FONT-SIZE: 9pt; COLOR: #333333; FONT-FAMILY: Arial">0000?0?0? (?) 
                                ?? 00:00:00</SPAN>
        </div>
    </form>
</body>
</html>
 

Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
5 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Standard C Date/Time Library: Programming the World's Calendars and Clocks Authors: Lance Latham, Pages: 560, Published: 1998
Date Me, Baby, One More Time Authors: Stephanie Rowe, Pages: 0, Published: 2007
PCs for Dummies Authors: Dan Gookin, Andy Rathbone, Pages: 432, Published: 2003
Who Offers Part-Time Degree Programs?: The Most Complete Overview to Date of the Part-time Degree Opportunities--daytime, Evening, Weekend, Summer, and External Degree Programs--available from Accredited Colleges and Universities in the U.S. Authors: Patricia Consolloy, Peterson's Guides, inc, Pages: 350, Published: 1981
Webmaster in a Nutshell: A Desktop Quick Reference Authors: Stephen Spainhour, Robert Eckstein, Pages: 561, Published: 2003
Workmen's Compensation Appeals, 1910-11: A Critical Commentary on the Workmen's Compensation Case Law for the Past Legal Year and Brought Up to Date to the Time of Publication Authors: Climenson Yelverton Charles Dawbarn, Pages: 128, Published: 1912
The Narcotic Drugs and Psychotropic Substances ACT, 1985 (ACT 61 of 1985): With Rules Framed by the Central Government and State Governments and All Up to Date Notifications Issued from Time to Time by the Central Government, with Short Notes Authors: India, Ajai Kumar Aggarwal, Tarun Mehta, Pages: 176, Published: 1986

Web:
Time and Date This site includes lots of information that is time and date related, such as yearly and monthly calendars, countdown counters and the world clock which ...
Time and Date The World Clock shows current local time in cities and countries, in all time zones.
The official U.S. time - clock Right now, the official U.S. time is: :. You have chosen the time zone.
Date and Time Formats ISO 8601 describes a large number of date/time formats. To reduce the scope for error and the complexity of software, it is useful to restrict the supported ...
Today Date and Time Information on all things relating to calendars, dates, holidays, and time. Find today's date on several different cultural and religious calendars.
Calendar Time and Date refdesk.com Today Date and Time - today's date in various calendars and eras. Links to " today" info throughout the Web. Celestial and astronomical info. ...
INDUSTORIOUS CLOCK ||| MONO*CRAFTS3.0 Clock using video of a hand drawing to display the time.
MySQL :: MySQL 5.0 Reference Manual :: 11.6 Date and Time Functions See Section 10.3, “Date and Time Types”, for a description of the range of values each date and time type has and the valid formats in which values may be ...
International standard date and time notation International Standard ISO 8601 specifies numeric representations of date and time. It helps to avoid confusion caused by the many different national ...
Dynamic Drive- Date and Time This is a live count down script that can be set to count down to any future date/time, such as Christmas, your dad's birthday etc. Customize all aspects of ...

Videos:
Excel Basics #9: Formatting & Date & Time Math See how to use Date & Time formatting. See how to create date and time math formulas in Excel. See how to calculate "how many past due" an invoice is...
Durrty Dav: Lunch Date - Comedy Time Dav uses his technical know-how to score a date with receptionist Lisa.
ShopNBC Talking Wrist Blood Pressure Monitor This innovative talking blood pressure monitor helps two users keep their blood pressure in check. It also reads mean arterial pressure as well as pu...
Microsoft Access Date & Time Calculations How to calculate the number of hours or days between two dates in Microsoft Access
Tutorial Visual basic 6 date and time I gonna show u how to make an Date and Time aplication in Visual basic 6 i hope u enjoy
Date & Time (Official Trailer) *** NEW *** New Official trailer for the feature film, "Date & Time." A slapstick romantic comedy about meeting someone in person for the first time. And the...
the day you went away well i wonder could it be when i was dreaming about you baby you were dreaming of me call me crazy call me blind to still be suffering is stupid...
"Inherit the Wind" - Age of Earth Disputed "Bryan testified in court that the world was created in six 24-hour days but then went even farther. Based on calculations made by Bishop Usher in t...
Visual Basic Tutorial 3 - Date and Time Clock Answering to a request.
Transforming lives with Information and Communications Technology Institute of Rural Health Think Tank Series Chaired by Rameshsharma Ramloll Date and Time: Feb 16, 2006 02:00 PM to 03:00 PM MST Presenter: Kristin ...




Search This Site:










forums???

dnn 308 users module error help please

control (decrease, limit) the speed (bandwidth) of downloading and uploading

wilson o/r mapper

control in control problems

i use htmlencode, but if the user name is sánchez he sees s&#225;nchez. how can i solve it?

how to validate fonts for a particular language?

low-impact logging

making a one off home page image (tabid=1)

how can i configure dnn to show rtl?

[resolved] panels side by side

requiredtextbox - composite control or inherit from textbox

why doesn't the ~/something.aspx work with stylesheets ?!?!

dnn 3.2.0 and the treeview

escaping client script blocks

how to retrive a picture from a database table column and display it in an image sever control

where can i get some ... stock photography?

preventing simultaneous logging

how to: prevent cross-site scripting in asp.net

upcoming changes to asp.net 2.0 in beta 2

skipping theme for one page

dnn e-commerce modules (ais-ec) release announcement: ais-ec 1.0.3

freeskin 4 y'all

container css problem

custom / compare validators

dnn 3.0, xhtml strict, tableless design & xhtmlwebcontrols...

javascript serverside

is there any way of doing this..

radio button event not firing

tabs control panel

 
All Times Are GMT