Results 1 to 4 of 4

Thread: Redirecting a frame useing asp and/or javascript [Resolved]

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2005
    Posts
    43

    Resolved Redirecting a frame useing asp and/or javascript [Resolved]

    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
    Code:
    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
    Last edited by Draven Chen Zhen; Apr 15th, 2005 at 01:27 AM.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Redirecting a frame useing asp and/or javascript

    Do it cilent-side.

    Add the javascript

    Code:
    parent.framename.location.href='http://www.mendhak.com/';
    Add it to the LinkButton's onclick event.

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2005
    Posts
    43

    Re: Redirecting a frame useing asp and/or javascript

    Quote Originally Posted by mendhak
    Do it cilent-side.

    Add the javascript

    Code:
    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

    Code:
    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>");

  4. #4

    Thread Starter
    Member
    Join Date
    Mar 2005
    Posts
    43

    Re: Redirecting a frame useing asp and/or javascript

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width