Java Script doesn't run before server.transfer
-
I am using a javascript alert as a msgbox temp = " alert ('Login Required'); " page.registerstartupscript("login",temp) script works fine until I add server.transfer("login.aspx") the transfer works and the script doesn't execute Any Ideas on how to force the script to run first then the transfer
-
I am using a javascript alert as a msgbox temp = " alert ('Login Required'); " page.registerstartupscript("login",temp) script works fine until I add server.transfer("login.aspx") the transfer works and the script doesn't execute Any Ideas on how to force the script to run first then the transfer
-
I am using a javascript alert as a msgbox temp = " alert ('Login Required'); " page.registerstartupscript("login",temp) script works fine until I add server.transfer("login.aspx") the transfer works and the script doesn't execute Any Ideas on how to force the script to run first then the transfer
Hi, unfortunately this can't work, because when you call Server.Transfer, response stream is cleared. If you want to show page "login.aspx" with this client-side script, you must generate client side script from that web form. You can use query string for this:
Server.Transfer("login.aspx?showalert=true");
And in login.aspx:
if (Request.QueryString["showalert"]="true")
{
string temp="<script language="javascript"> alert ('Login Required');</script>"
Page.RegisterStartupScript("login",temp);
}Tomáš Petříček (Microsoft C# MVP)
www.eeeksoft.net | Asp.Net Graphical controls -
Hi, unfortunately this can't work, because when you call Server.Transfer, response stream is cleared. If you want to show page "login.aspx" with this client-side script, you must generate client side script from that web form. You can use query string for this:
Server.Transfer("login.aspx?showalert=true");
And in login.aspx:
if (Request.QueryString["showalert"]="true")
{
string temp="<script language="javascript"> alert ('Login Required');</script>"
Page.RegisterStartupScript("login",temp);
}Tomáš Petříček (Microsoft C# MVP)
www.eeeksoft.net | Asp.Net Graphical controls