I found this in an MSDN post.
You can't do it directly but if you add the following to the server side Page_Load in the code behind, you can check for the javascript variable on the client side.
server side:
protected void Page_Load(object sender, EventArgs e)
{
// NOTE: the following uses an overload of RegisterClientScriptBlock()
// that will surround our string with the needed script tags .
ClientScript.RegisterClientScriptBlock(GetType(), "IsPostBack", string.Format("var isPostBack = {0};", (IsPostBack ? "true" : "false")), true);
}
client side:
<head>
...
...
</head>
<body onload="doSomething();">