PDA

Click to See Complete Forum and Search --> : Redirecting a frame useing asp and/or javascript [Resolved]


Draven Chen Zhen
Apr 5th, 2005, 01:39 AM
I want to redirect an iframe (is called "main") in my page by useing a linkbutton in asp.net

When I click on the linkbutton the fuction test is called
private void test(object sender, System.EventArgs e)
{
Response.Write("<script>window.parent.main.location = 'http://google.be'</script>");
}

I also tryed

Response.Write("<script>_parent.location.replace('http://google.be')</script>");
Response.Write("<script>window.frames[“main”].location.replace('http://google.be')</script>");
Response.Write("<script>window.frames[“main”].location.href='http://google.be'</script>");


But non of the scripts seem to work :ehh:

mendhak
Apr 5th, 2005, 01:50 AM
Do it cilent-side.

Add the javascript


parent.framename.location.href='http://www.mendhak.com/';


Add it to the LinkButton's onclick event.

Draven Chen Zhen
Apr 5th, 2005, 02:27 AM
Do it cilent-side.

Add the javascript


parent.framename.location.href='http://www.mendhak.com/';


Add it to the LinkButton's onclick event.

That would work, but I also need to make 2 sessions ... when I click the link

So I need to call on an event and redirect my Iframe

here is some code I've tried but also didn't work :( :(

string strRedirect;
strRedirect = "<script language='Javascript'>";
strRedirect += "parent.frames('main').location.href='http://google.be';";
strRedirect += "</script>";
Response.Write(strRedirect);
Response.Flush();


Response.Write("<script>window.main.location = 'http://google.be'</script>");
Response.Write("<script>window.open('../Plant/Plant.aspx','main');</script>");

Draven Chen Zhen
Apr 5th, 2005, 04:18 AM
nevermind I found a solution ... I call on a fuction in C# there I make my 2 sessions, next I redirect my page (index.aspx) back to index.aspx but I put a parameter in the url : index.aspx?Page=lala.aspx

And in my iframe the source becomes now src="<%= Request["Page"] %>"

E voila I redirect my Iframe :thumb: