- About
- Expression Web Forum
- Expression web resources
- CSS
- 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
- .style1
- Build Expression Web DWT Tutorial
- Graphic Template example
- Free Expression Web Templates
- Add RSS to Expression Web
- Expression web forms
- Contact
- 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
Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<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();
}
</script>
</head>
<body>
<p>Hello there!</p>
<p>The time is now:
<asp:Label runat="server" id="timeLabel" /></p>
</body>
</html>
The code
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.
Styling
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.
Limitations
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.
RSS
Our forum feed can be found here
Reader not listed? Click here for more options
Expression Web Help RSS
Expression Web Help. Tips and Tricks and tutorials Get our feed now