I am using the below code
protected void lnk_Click(object sender, EventArgs e)
{
try
{
string strlink = ConfigurationManager.AppSettings["link"].ToString().Trim();
StringBuilder sb = new StringBuilder();
sb.Append("<script type = 'text/javascript'>");
sb.Append("window.open('");
sb.Append(strlink);
sb.Append("');");
sb.Append("</script>");
ClientScript.RegisterStartupScript(this.GetType(), "script", sb.ToString());
}
}
In the page there are two links. When i click the first link it opens a window in a new page. I do this by using the above code.
I am clicking the second link in the page and navigating to another page. Now i am clicking the browser back button. Supprisingly its opening the first link.
How clicking back button is opening the link in the page.
I am using c# .net 2005.
Please help. Thanks.
Regards,enter code here
Radha A
I’d say your code is doing more or less exactly what you told it to… what do you think RegisterStartupScript does?
If you want the window to open only when you click on the actual link, then attach your javascript to the onclick of that anchor.