On Jun 7, 8:04 am, Steve Kershaw <steve_kers...@ yahoo.comwrote:
Hi,
I need to display a seperate error page (off a try...catch block) in
ASP.NET.
Response.Redire ct and Server.Transfer won't work in this case because
they replace the
old page with a new one and I want both pages to be displayed (error
page on top of course).
An alternate question is; how can I call a javascript function from an
ASP.NET method?
That way I can simply use the window.alert("e rror message here");
javascript function.
Thanks
Steve
You could always display the error, then auto-redirect after x
seconds, or a user click
in side js block...
function redirTimer( sURL, iSecondsDelay){
self.setTimeout ("self.location .href='" + sURL + "';",
iSecondsDelay);
//show(false,'tes tJava');
}
or
open a new window after page load (pop up blockers could be
problematic like bruce mentioned.
function popWin1(url, thePreference)
{
// Create offset
if (document.all) {
xMax = screen.width;
yMax = screen.height;
}
else {
if (document.layer s) {
xMax = window.outerWid th;
yMax = window.outerHei ght;
}
else {
xMax = 400;
yMax=480;
}
}
var xOffset = (xMax - 586)/2;
var yOffset = (yMax - 700)/2;
thePreference = thePreference + ',screenX='+xOf fset
+',screenY='+yO ffset+',top='+y Offset+',left=' +xOffset
+'resizable=tru e,scrollbars=ye s';
// alert("Preferen ce = " + thePreference);
if (typeof(popupWi n) != "object"){
popupWin = window.open(url , 'window2', thePreference);
}
if (popupWin.close d){
popupWin = window.open(url , 'window2', thePreference);
}
if( popupWin.opener == window) {
popupWin.focus( );
return;
}
return;
}