S
SimonZ
I have function in my app_code folder.
Is it possible to register client script block from app_code function?
public static void CheckSessionModal()
{
String scriptValue="";
scriptValue = "<script language=\"vbscript\">" + Environment.NewLine +
"window.returnValue=-1"+
"window.close"+Environment.NewLine+"</script>";
Page.ClientScript.RegisterStartupScript(GetType(), "scriptName",
scriptValue);
}
From every page in my program I call this function from page_onload event:
functions.CheckSessionModal()
But when I do this, I get an error message:
Error 2 An object reference is required for the nonstatic field, method, or
property 'System.Web.UI.Page.ClientScript.get'
c:\inetpub\wwwroot\CP\App_Code\functions.cs 452 13 http://localhost/CP/
Error 3 An object reference is required for the nonstatic field, method, or
property 'object.GetType()' c:\inetpub\wwwroot\CP\App_Code\functions.cs 452
53 http://localhost/CP/
How can I do that, any idea?
Thank you,
Simon
Is it possible to register client script block from app_code function?
public static void CheckSessionModal()
{
String scriptValue="";
scriptValue = "<script language=\"vbscript\">" + Environment.NewLine +
"window.returnValue=-1"+
"window.close"+Environment.NewLine+"</script>";
Page.ClientScript.RegisterStartupScript(GetType(), "scriptName",
scriptValue);
}
From every page in my program I call this function from page_onload event:
functions.CheckSessionModal()
But when I do this, I get an error message:
Error 2 An object reference is required for the nonstatic field, method, or
property 'System.Web.UI.Page.ClientScript.get'
c:\inetpub\wwwroot\CP\App_Code\functions.cs 452 13 http://localhost/CP/
Error 3 An object reference is required for the nonstatic field, method, or
property 'object.GetType()' c:\inetpub\wwwroot\CP\App_Code\functions.cs 452
53 http://localhost/CP/
How can I do that, any idea?
Thank you,
Simon