F
fxs
Hello, I've got the following elements on my page:
A Body tag that looks like this:
<body onload="setTabs()">
A Javascript script in the <head> that has:
var foo;
function setTabs()
{
doSomething(foo);
}
I want my ASP.NET page to set the value of foo so that it gets used in the
setTabs() function onload of the page.
So, I tried the following in Page_Load()
string strScript = "<script language='javascript'>foo=" +
Request.QueryString["var"].ToString() + "; </script>";
if(!this.IsClientScriptBlockRegistered("clientScript"))
this.RegisterClientScriptBlock("clientScript", scriptString);
This obviously does not seem to work.I'm trying to therefore figure out, how
do I set the value of a client side javascript variable (foo) based on the
value of my serverside variable request.querystring["var"]?
Any help would be appreciated.
thanks,
fxs
A Body tag that looks like this:
<body onload="setTabs()">
A Javascript script in the <head> that has:
var foo;
function setTabs()
{
doSomething(foo);
}
I want my ASP.NET page to set the value of foo so that it gets used in the
setTabs() function onload of the page.
So, I tried the following in Page_Load()
string strScript = "<script language='javascript'>foo=" +
Request.QueryString["var"].ToString() + "; </script>";
if(!this.IsClientScriptBlockRegistered("clientScript"))
this.RegisterClientScriptBlock("clientScript", scriptString);
This obviously does not seem to work.I'm trying to therefore figure out, how
do I set the value of a client side javascript variable (foo) based on the
value of my serverside variable request.querystring["var"]?
Any help would be appreciated.
thanks,
fxs