Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > RegisterStartupScript problem

Reply
Thread Tools

RegisterStartupScript problem

 
 
Kaan Acar
Guest
Posts: n/a
 
      03-17-2005
Hi ,

i am using vbscript to open word document in my web page.(web page
is written in c# )
The code snippet in below. This code is doing what i want.
however when i try
to go back opener page with internet explorer "Back" button this
function is working again and word document is opening so i could
not open my page again.Is there any solution to unregister or block
this script...

string redirect = "c:/NewFolder/xxx.doc";
script = "<SCRIPT language='vbScript'>"
+ " window.location=\"" + redirect + "\""
+ " '</SCRIPT>";
Page.RegisterStartupScript("__JS_OPENFILE",script) ;

thanks..
 
Reply With Quote
 
 
 
 
Greg Finzer
Guest
Posts: n/a
 
      12-23-2005
While you cannot unregister a script, you can re-register the script and
have the function do nothing. See the example code below. This could
turned on or off when PagePostBack == false.

if (turnOn == true)
{
sbAlertScript.Append("<script language='javascript'>\n");
sbAlertScript.Append("function ShowMessageOfTheDay()\n");
sbAlertScript.Append("{\n");
sbAlertScript.Append("alert(\"" + message + "\");\n");
sbAlertScript.Append("}\n");
sbAlertScript.Append("</script>\n");

Page.RegisterStartupScript("alertScript", sbAlertScript.ToString());
}
else
{
sbAlertScript.Append("<script language='javascript'>\n");
sbAlertScript.Append("function ShowMessageOfTheDay()\n");
sbAlertScript.Append("{\n");
sbAlertScript.Append("\n");
sbAlertScript.Append("}\n");
sbAlertScript.Append("</script>\n");
Page.RegisterStartupScript("alertScript", sbAlertScript.ToString());
}

--------------------------------
From: Greg Finzer
<a href="http://www.kellermansoftware.com">Kellerman Software</a>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ClientScript.RegisterStartupScript problem HockeyFan ASP .Net 1 07-20-2007 02:30 PM
Using Page.RegisterStartupScript in Class Earl Teigrob ASP .Net 2 02-03-2004 09:27 PM
RegisterStartupScript() and RegisterClientScriptBlock() Mark ASP .Net 1 10-16-2003 04:23 PM
Re: client side script with RegisterStartupScript issue bruce barker ASP .Net 1 07-31-2003 08:39 PM
Re: RegisterClientScriptBlock & RegisterStartupScript revisited Brian W ASP .Net 1 07-04-2003 01:43 AM



Advertisments