Essentially you need to start the timer server-side and then ensure that page refreshes do not alter the client-side countdown status (otherwise you just need to refresh constantly to reset the timer)

To invoke the timer I have the following:

[CODE]
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{ TimerStart(); }
}
[/CODE]

The TimerStart routine is defined as:

[CODE]
private void TimerStart()
{
if (Session["TimerStart"] == null)
{
Session["TimerStart"] = true;
endDate = new BOL.Date();
}
}
[/CODE]

The Session settings is to prevent the page refreshes as mentioned earlier and the class BOL.Date is a class I have created to return the date from my SQL server, it allows me to break the date format down into year, month, day, hour, minute, seconds - if you don't have access to an SQL server you can use various methods to return this information easily.

The user can move to the next item in my list of items displayed without waiting for a full count down by pressing the 'Next Button', the code for this is as follows:

[CODE]
protected void btnNext_Click(object sender, System.EventArgs e)
{
Session["TimerStart"] = null;
TimerStart();
}
[/CODE]

To start the javascript timer, the following code needs to be added to the PreRender:

[CODE]
protected override void OnPreRender(EventArgs e)
{
if (Session["TimerStart"] != null)
{
string script = string.Format("javascript: countdownTimer({0}, {1}, {2}, {3}, {4}, {5}, {6});", endDate.Year, endDate.Month, endDate.Day, endDate.Hour, endDate.Minute, endDate.Second, );
ScriptManager.RegisterStartupScript(this, this.GetType(), "TimerStarted", script, true);
}

base.OnPreRender(e);

}[/CODE]

The is ...

__avd commented: Good post! :) +11

There is some debate whether its a good idea to store images in a database or on a file server.

If you insist on using a database then you'll need to set up a webhandler file which streams the image to your webpage.

Create a new item in your project of type of WebHandler and call it PhotoHandler

Then change the code to the following:

[CODE]

<%@ webhandler language="C#" class="PhotoHandler" %>
using System;
using System.Web;
using System.Data;
using System.Data.SqlClient;

public class PhotoHandler : IHttpHandler
{
public bool IsReusable { get { return true; } }

public void ProcessRequest(HttpContext ctx) 
{ 
    string id = ctx.Request.QueryString["PhotoID"]; 

    SqlConnection con = new SqlConnection(<<INSERT CONNECTION STRING HERE>>); 
    SqlCommand cmd = new SqlCommand("SELECT [PhotoData] FROM [PhotoTable] WHERE PhotoID = @PhotoID", con); 
    cmd.CommandType = CommandType.Text; 
    cmd.Parameters.Add("@PhotoID", PhotoID); 

    con.Open(); 
    byte[] pict = (byte[])cmd.ExecuteScalar(); 
    con.Close(); 

    ctx.Response.ContentType = "image/bmp"; 
    ctx.Response.OutputStream.Write(pict, 0, pict.Length); 
} 

}

[/CODE]

then in your Web page you would do the following:

[CODE]

[/CODE]

__avd commented: Good option! +11

If you dragged the table onto your form then a datasource will have been added automatically with the relevant INSERT, UPDATE and DELETE routines already created

[URL="http://www.asp.net/data-access/tutorials/querying-data-with-the-sqldatasource-control-vb"]http://www.asp.net/data-access/tutorials/querying-data-with-the-sqldatasource-control-vb[/URL]