Join our community
- Expression Web Forum
- Expression web resources
- Build Expression Web Template 1
- Build Expression Web template 2
- Build Expression Web Template 3
- Style horizontal Navigation with CSS
- Style vertical menu with CSS
- Style the main content area
- Style the footer
- Centre a page
- Build Expression Web DWT Tutorial
- Graphic Template example
- Free Expression Web Templates
- Add RSS to Expression Web
- Expression web forms
- RSS feeds
- 10 Tips
- Page includes
- Insert flash in expression web
- Expression web dropdown menu
- Use XML with Expression Web
- Point and click easy drop-down menu's
- Table Based Layouts
- ASP.NET Ad Rotator
- Display Data
- Search database using a text box
- Transparent Text
- Bold text - Formatting
- Date and time
- Who are you
Insert the date and time
If you need to add a date and time to an expression web page, you can use some asp.net v2 code. Your page must be an aspx page.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
<title>My First ASP.NET Page</title>
<script runat="server" language="C#">
protected void Page_Load(object sender, EventArgs e)
timeLabel.Text = DateTime.Now.ToString();
<p>The time is now:
<asp:Label runat="server" id="timeLabel" /></p>
Copy the above code and paste it into a html page. Click on save and name your page. From the file type dropdown, select aspx.
Test your page in a browser.
You can style the display by either setting the properties in the Tag Properties task pane, or with a CSS class style.
Simply click on the time label in design view and the tag property task pane will display the options open to you. If you want to use a class then click on the CSSClass option which can be found in the appearance section of the tag properties task pane.
Using the code provided, has some minor limitations. It provides a snap shot of time (it updates on refresh) and the format is as is. Also it displays the server time, tricky if you host outside your time zone.
I suspect there are many ways to format the code but i have not looked into this. However i would be delighted to open a discussion at our forum.