popup message not showing properly

Posted by Klbaiju under ASP.NET on 8/27/2012 | Points: 10 | Views : 1691 | Status : [Member] | Replies : 3
Hi,

in my application
I want to display a popup message like this
if(condition)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key2", "<script> alert('Your Session is expired'); </script>");
Response.Redirect("../Default.aspx",true);
}

the problem is response.redirect is only working.
if i comment response.redirect, popup will show.
i want to display popup before going to another page.

how it is possible.

Regards
Baiju




Responses

Posted by: Nadh123 on: 8/27/2012 [Member] Starter | Points: 25

Up
0
Down
First Server side coding write a java script first server side event complte again client side script working
try it this following below code
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "msg", "alert('Your Session is expired!');window.location.href('./Default.aspx');", true);

Mahendra
91-9908699686

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gopesh9 on: 8/27/2012 [Member] Starter | Points: 25

Up
0
Down
Add this to your Page Load

Page.ClientScript.RegisterStartupScript(this.GetType(), "key2", "<script> alert('Your Session is expired'); </script>");Response.Redirect("../Default.aspx",true);

G. S.
.Net Developer

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 8/27/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Try this,
 

Page.ClientScript.RegisterStartupScript(typeof(Page), "Expired", "alert('Your Session is expired!');window.location.href='../Default.aspx'", true);

Or,
if u r working with AJAX try this,

ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Expired", "alert('Your Session is expired!');window.location.href='../Default.aspx'", true);



Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response