Does Page.RegisterClientScriptBlock Not Work Under ASP.NET 2.0?

G

Guest

Hello,

I have an app that was xcopy deployed from an ASP.NET 1.1 W2KServer to a box
running ASP.NET 2.0 W2003Server. The app runs fine with the exception of
where I use the above method. It just doesn't seem to work at all anymore. I
get no errors...but what used to work...now just doesn't work.

I use it to emit jscript from an opened window to reflect changes being made
back on the parent window that launched it.
Any ideas?

Paul Reed
 
M

Masudur

Hello,

I have an app that was xcopy deployed from an ASP.NET 1.1 W2KServer to a box
running ASP.NET 2.0 W2003Server. The app runs fine with the exception of
where I use the above method. It just doesn't seem to work at all anymore. I
get no errors...but what used to work...now just doesn't work.

I use it to emit jscript from an opened window to reflect changes being made
back on the parent window that launched it.
Any ideas?

Paul Reed

Hi...

Try using

if (!Page.ClientScript.IsClientScriptBlockRegistered("Key"))
{

Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Key",
script);
}


Thanks
Masudur
 
G

Guest

Paul said:
Hello,

I have an app that was xcopy deployed from an ASP.NET 1.1 W2KServer to a box
running ASP.NET 2.0 W2003Server. The app runs fine with the exception of
where I use the above method. It just doesn't seem to work at all anymore. I
get no errors...but what used to work...now just doesn't work.

I use it to emit jscript from an opened window to reflect changes being made
back on the parent window that launched it.
Any ideas?

The Page.RegisterClientScriptBlock method has been deprecated in favor
of the Page.ClientScript.RegisterClientScriptBlock method.

It still works, though. It's more likely that there is something wrong
with the Javascript code. Have you enabled Javascript error messages in
Internet Explorer? Otherwise they will just show up as a notification in
the status bar. If you are using Firefox, open the Error Console to see
the error messages.
 
G

Guest

Thanks,

Well...I do have error reporting enabled for jscript but I get no error.
Here is my VB.NET code...which again has been working like a champ for years
on ASP1.1. Its also my understanding as well that the older (deprecated sig)
for this method should still work. I don't use VS2005 yet...so I am not
planning on having to change the code specific to 2.0 (I can change the
jscript if for some reason it is now the culprit...but don't know why).
Again...this app was simply copy deployed to the new box.


Dim strjscript As String = "<script language=""javascript"">"

txttotal.Text = CStr(dcTotal)

strjscript = strjscript & "window.opener.setEstimate("
strjscript = strjscript & txtBidHeader.Text & ", "
strjscript = strjscript & dcTotal & ", "
strjscript = strjscript & "'" & strDescription & "'"

strjscript = strjscript & ");window.close();"
strjscript = strjscript & "</script>"
Page.RegisterClientScriptBlock("", strjscript)
 
G

Guest

Mark,

Wow...this is bad news for me. I'm surprised my app didn't throw an error
then. Do you know if ASP.NET 1.1 can be run side-by-side on a box that is
also running ASP.NET 2.0? I know that both versions of the .NET framework can
co-exist on the same box. Thank you so much for taking the time to reply to
my previous posts.

Regards,

Paul Reed
 
M

Mark Rae [MVP]

Do you know if ASP.NET 1.1 can be run side-by-side on a box that is
also running ASP.NET 2.0?

Yes - just make sure you specify the correct target framework in the virtual
directory settings...
 
G

Guest

Mark,

Thanks...I should have researched my last question and not bothered you on
that. I've found doc for aspnet_regiis and will get busy. Thanks to you I'm
not spinning my wheels any longer.

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top