Update 2 with version for Visual Studio 2008 and .NET 3.5, here you have the documentation for that version, and as you can see is the same way as in the current version but less refactored.
Do you have the namespace added System.Web.UI
?
// Esto lo tienes?
using System.Web.UI;
protected void Button1_Click(object sender, EventArgs e) {
// Definir que vas a ejecutar en Javascript y el tipo
String script = "window.parent.location = '../pagina2.html'";
Type cstype = this.GetType();
// ClientScriptManager para la pagina
ClientScriptManager cs = Page.ClientScript;
// Ejecutar el scriptblock
cs.RegisterClientScriptBlock(cstype, script, script.ToString(), false);
}
Update that VS!
I update with a new proposal since it was not a quote error.
It can be done with Javascript with the window.parent
( MDN ) and the property location
, to call it from .NET use the ClientScriptManager
( MSDN ).
protected void Button1_Click(object sender, EventArgs e)
{
ClientScriptManager.RegisterClientScriptBlock(this.GetType(),
"RedirectScript", "window.parent.location = '../pagina2.html'", true);
}