Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect to a page 1

Status
Not open for further replies.

nnmmss72

Programmer
May 14, 2006
110
IR
i have .net page with a few Frames in it. i want whenever a button is click and some rules were check the parent page be directed to the another page or site

by writting this
Response.Redirect("UserCart.htm");
just that frame is redicted , but i want the parent page be directed to the page.

thanks
 
I think you want to have a look at Server.Transfer("page")

Hope this helps,

Alex

Ignorance of certain subjects is a great part of wisdom
 
Hmm, that's a tricky one. Response.Redirect works by sending a 302 error code back to your browser which is just redirecting the frame. Server.Transfer is not going to work either as it will still only load in the frame that sent the original request.

I guess the thing to do is to resort to some JavaScript. You could try sending back a page with:

<body onload="window.parent.location='NewURL.html'">
 
yes , u r right, but i want to send the parent page to another page after some checking in a server side,

i can not understand how this can solve my problem
<body onload="window.parent.location='NewURL.html'">
???
 
I think you'll use javascript but not on "body/onload". You should use it on onclick event of button (you can perform some clientside controls if you wish here)

OnClick function will look like this:

Code:
function btnXXXclick()
{
	//client-side controls goes here if you want
	parent.location.href='redirector.aspx';
}

On redirector.aspx (Serverside) you'll perform your serverside controls and then response.redirect the request to the desired page.

If I understand your need wrong, please explain a little more...

Regards,
Ali
 
You can try this code to add the rdirect to the response page:

Code:
if (PerformChecks())
{
    this.ClientScript.RegisterStartupScript(this.GetType(), "SomeKey", "window.parent.location=\"NewURL.html\"", true);
}

Or you can create a dummy page and do a Response.Redirect to that.
 
sorry for delay

captainPlus : well actually it is not important for me using javascript or not. just it is important that in the Flag is true so the parent farme should be redircting to page or website

Aptitude : i couldn't find ClientScript in anywhere it gets error of using ClientScript. I am using ASP.NET 1.0, is that related?

thanks
 
If you are using version 1.0 of the framework, the ClientScript.RegisterStartupScript method should be replaced by Page.RegisterStartupScript.


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244 on how to get better results.
 
well i did as following
Page.RegisterStartupScript("somekey","window.parent.location='
but nothing happens except when the button is click this text is appear on screen

window.parent.location='
isn't really any simple way to cause the parent farme move on?
 
but nothing happens except when the button is click this text is appear on screen
That's because you haven't placed it inside script tags so how is it supposed to know it is javascript?

isn't really any simple way to cause the parent farme move on?
Only with javascript. ASP.NET page run on the server (hence Active Server Pages) so it has absolutely no concept of client side frames.


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244 on how to get better results.
 
In .Net 1.0 & 1.1 you need to do the following:

Code:
Page.RegisterStartupScript("somekey", "<script language=\"javascript\" type=\"text/javascript\">window.parent.location=\"[URL unfurl="true"]http://www.sb.com\"</script>");[/URL]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top