M
Mike P
I'm trying to write some code in my Page_Load where the user can click
OK or Cancel in a message box to decide whether they want to be
redirected or not. If the user clicks OK, then they will be redirected,
if they click Cancel, then they will be sent back to the previous page.
The error that I am getting is 'newline in constant' at the part where I
am creating the sScript string.
Can anybody help with this?
Cheers,
Mike
string sPage = "";
string sScript;
switch (Convert.ToString(Request.QueryString"action"))
{
case "AI":
sPage = activate_invisilink.aspx?serial=" + strSerial);
break;
case "AT":
sPage = activate_targeted.aspx?serial=" + strSerial);
break;
}
sScript = "<script type=\"text/javascript\">";
sScript += "if(confirm('this is the message for the confirm box'))
document.location.href='" + sPage + "';";
sScript += "else document.location.href='lastpage.aspx';";
sScript += "</script>";
Page.RegisterClientScriptBlock("Redirect", sScript);
OK or Cancel in a message box to decide whether they want to be
redirected or not. If the user clicks OK, then they will be redirected,
if they click Cancel, then they will be sent back to the previous page.
The error that I am getting is 'newline in constant' at the part where I
am creating the sScript string.
Can anybody help with this?
Cheers,
Mike
string sPage = "";
string sScript;
switch (Convert.ToString(Request.QueryString"action"))
{
case "AI":
sPage = activate_invisilink.aspx?serial=" + strSerial);
break;
case "AT":
sPage = activate_targeted.aspx?serial=" + strSerial);
break;
}
sScript = "<script type=\"text/javascript\">";
sScript += "if(confirm('this is the message for the confirm box'))
document.location.href='" + sPage + "';";
sScript += "else document.location.href='lastpage.aspx';";
sScript += "</script>";
Page.RegisterClientScriptBlock("Redirect", sScript);