Well, try something like:
Page.ClientScript.RegisterStartupScript(Type.GetType("System.String"), "addScript", "DisplayDateTime()", true);
P.S.: The
RegisterClientScriptBlock
method adds a script block to the top of the rendered page. While, the script block added by the
RegisterStartupScript
method executes when the page finishes loading but before the page's OnLoad event is raised.
(it means the RegisterStartupScript method adds a script block to the end of the rendered page.)