By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,296 Members | 1,476 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,296 IT Pros & Developers. It's quick & easy.

asp:button and response.redirect _top

P: n/a
I have a site that uses frames. I made an aspx form with an asp:button
control with Onclick=test. The test sub is:

Sub Test(ByVal sender As Object, ByVal e As System.EventArgs)

Response.Redirect("http://webserver/policies/pppindex.htm target=_blank")

End Sub

Of course, this will not work. Is there some way I can get a similar result
without using normal HTML? I don't want the page to load within the frame as
it would if I wrote it
response.redirect(http://webserver/policies/pppindex.htm)

Thanks for your help.
Jim
Nov 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi Jim,

A little about HTTP:

A Response is a response to a Request. The Request comes from a browser
instance on the client. A FrameSet has multiple browser instances. When a
frame (browser instance) sends a Request, the Response is sent back to the
same client browser instance (of course). That means that Response.Redirect,
which is a Response to a Request, is a Response to a Request from a certain
browser instance. Targeting a frame therefore, can only be done on the
client, as that is where the frames are linked by the parent browser.

What I would do is to add some JavaScript to the Response, which changes the
target frame's document.location property to the URL you want loaded into
that frame. That is, as the Response will come back to the browser instance
that sent the Request, it can refresh the page, and add a javascript to it,
something like the following:

<script type="text/javascript"><!--
parent.frameName.location = "url";
// -></script>

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Jim in Arizona" <ti*******@hotmail.com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
I have a site that uses frames. I made an aspx form with an asp:button
control with Onclick=test. The test sub is:

Sub Test(ByVal sender As Object, ByVal e As System.EventArgs)

Response.Redirect("http://webserver/policies/pppindex.htm target=_blank")

End Sub

Of course, this will not work. Is there some way I can get a similar
result without using normal HTML? I don't want the page to load within the
frame as it would if I wrote it
response.redirect(http://webserver/policies/pppindex.htm)

Thanks for your help.
Jim

Nov 19 '05 #2

P: n/a
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi Jim,

A little about HTTP:

A Response is a response to a Request. The Request comes from a browser
instance on the client. A FrameSet has multiple browser instances. When a
frame (browser instance) sends a Request, the Response is sent back to the
same client browser instance (of course). That means that
Response.Redirect, which is a Response to a Request, is a Response to a
Request from a certain browser instance. Targeting a frame therefore, can
only be done on the client, as that is where the frames are linked by the
parent browser.

What I would do is to add some JavaScript to the Response, which changes
the target frame's document.location property to the URL you want loaded
into that frame. That is, as the Response will come back to the browser
instance that sent the Request, it can refresh the page, and add a
javascript to it, something like the following:

<script type="text/javascript"><!--
parent.frameName.location = "url";
// -></script>

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

------snip------

I should have known better. Of course, I was hopeful in some way that there
would be some simple soulution.

I have not worked with javascipt (enough) and I'm still pretty new to vb
(newer to vb.net). I wouldn't know how to implement a script like that in
any fashion.

My normal html link from before was <a href="/policies/pppindex.htm"
target=_top>link here</a>, which of course removed all frames and loaded the
single htm page in place of the frames. When you say
parent.framename.location, I don't know what portion of that is referring to
what part of my standard link.

Would there be some other way of writing the Test Subprocedure to make my
pretty graphical button work, or am I forced to use standard HTML or
javascript?

Thanks for your help Kevin.

Jim
Nov 19 '05 #3

P: n/a
Hi JJim,
My normal html link from before was <a href="/policies/pppindex.htm"
target=_top>link here</a>, which of course removed all frames and loaded
the single htm page in place of the frames. When you say
parent.framename.location, I don't know what portion of that is referring
to what part of my standard link.
Well, you could always have a regular link that goes to:

/policies/ppindex.htm target=frameName

....where "frameName" is the name of the frame you want loaded.
I have not worked with javascipt (enough) and I'm still pretty new to vb
(newer to vb.net). I wouldn't know how to implement a script like that in
any fashion.
Just one last comment: Every programmer runs into a situation in which
he/she has "not worked with " some technology, language, or other, from time
to time. The way you improve is to research the new thing when you run into
it, rather than running away from it. Just a couple of weeks ago I had the
task of adding water to a 3-D terrain mapping engine. I found the National
Land Cover Data Set on the USGS web site, but that was only the beginning.
The data was stored in GeoTiffs, which is a specialized form of Tiff file.
To make it worse, it was stored in Albers Equal Araeqa Conical projection.
Now, I knew nothing about parsing Tiff files, much less deriving Lat/Long
information from a raster image with Albers Equal Area Conical projection.
But I do now! ;-)

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Jim in Arizona" <ti*******@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... "Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi Jim,

A little about HTTP:

A Response is a response to a Request. The Request comes from a browser
instance on the client. A FrameSet has multiple browser instances. When a
frame (browser instance) sends a Request, the Response is sent back to
the same client browser instance (of course). That means that
Response.Redirect, which is a Response to a Request, is a Response to a
Request from a certain browser instance. Targeting a frame therefore, can
only be done on the client, as that is where the frames are linked by the
parent browser.

What I would do is to add some JavaScript to the Response, which changes
the target frame's document.location property to the URL you want loaded
into that frame. That is, as the Response will come back to the browser
instance that sent the Request, it can refresh the page, and add a
javascript to it, something like the following:

<script type="text/javascript"><!--
parent.frameName.location = "url";
// -></script>

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

------snip------

I should have known better. Of course, I was hopeful in some way that
there would be some simple soulution.

I have not worked with javascipt (enough) and I'm still pretty new to vb
(newer to vb.net). I wouldn't know how to implement a script like that in
any fashion.

My normal html link from before was <a href="/policies/pppindex.htm"
target=_top>link here</a>, which of course removed all frames and loaded
the single htm page in place of the frames. When you say
parent.framename.location, I don't know what portion of that is referring
to what part of my standard link.

Would there be some other way of writing the Test Subprocedure to make my
pretty graphical button work, or am I forced to use standard HTML or
javascript?

Thanks for your help Kevin.

Jim

Nov 19 '05 #4

P: n/a

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:ez*************@TK2MSFTNGP15.phx.gbl...
Hi JJim,
My normal html link from before was <a href="/policies/pppindex.htm"
target=_top>link here</a>, which of course removed all frames and loaded
the single htm page in place of the frames. When you say
parent.framename.location, I don't know what portion of that is referring
to what part of my standard link.


Well, you could always have a regular link that goes to:

/policies/ppindex.htm target=frameName

...where "frameName" is the name of the frame you want loaded.
I have not worked with javascipt (enough) and I'm still pretty new to vb
(newer to vb.net). I wouldn't know how to implement a script like that in
any fashion.


Just one last comment: Every programmer runs into a situation in which
he/she has "not worked with " some technology, language, or other, from
time to time. The way you improve is to research the new thing when you
run into it, rather than running away from it. Just a couple of weeks ago
I had the task of adding water to a 3-D terrain mapping engine. I found
the National Land Cover Data Set on the USGS web site, but that was only
the beginning. The data was stored in GeoTiffs, which is a specialized
form of Tiff file. To make it worse, it was stored in Albers Equal Araeqa
Conical projection. Now, I knew nothing about parsing Tiff files, much
less deriving Lat/Long information from a raster image with Albers Equal
Area Conical projection. But I do now! ;-)

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

Thanks for the insight.

I think I'm still a few days off before I open a book or pdf doc on parsing
Tiff files stored in Albers Equal Areqa Conical Projection. I tried to say
that three, then just two times fast and I couldn't do it! :)

I'll keep working on a solution. Depending on what I finally implement, I'll
let you know how it turned out. Should be amusing, and maybe informative, in
any case! :)

Jim
Nov 19 '05 #5

P: n/a
> I'll keep working on a solution. Depending on what I finally implement,
I'll let you know how it turned out. Should be amusing, and maybe
informative, in any case! :)
There you go man!

BTW, I misspelled "Area" - it should read "Albers Equal Area Conical
projection." For whatever that's worth!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Jim in Arizona" <ti*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:ez*************@TK2MSFTNGP15.phx.gbl...
Hi JJim,
My normal html link from before was <a href="/policies/pppindex.htm"
target=_top>link here</a>, which of course removed all frames and loaded
the single htm page in place of the frames. When you say
parent.framename.location, I don't know what portion of that is
referring to what part of my standard link.


Well, you could always have a regular link that goes to:

/policies/ppindex.htm target=frameName

...where "frameName" is the name of the frame you want loaded.
I have not worked with javascipt (enough) and I'm still pretty new to vb
(newer to vb.net). I wouldn't know how to implement a script like that
in any fashion.


Just one last comment: Every programmer runs into a situation in which
he/she has "not worked with " some technology, language, or other, from
time to time. The way you improve is to research the new thing when you
run into it, rather than running away from it. Just a couple of weeks ago
I had the task of adding water to a 3-D terrain mapping engine. I found
the National Land Cover Data Set on the USGS web site, but that was only
the beginning. The data was stored in GeoTiffs, which is a specialized
form of Tiff file. To make it worse, it was stored in Albers Equal Araeqa
Conical projection. Now, I knew nothing about parsing Tiff files, much
less deriving Lat/Long information from a raster image with Albers Equal
Area Conical projection. But I do now! ;-)

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

Thanks for the insight.

I think I'm still a few days off before I open a book or pdf doc on
parsing Tiff files stored in Albers Equal Areqa Conical Projection. I
tried to say that three, then just two times fast and I couldn't do it! :)

I'll keep working on a solution. Depending on what I finally implement,
I'll let you know how it turned out. Should be amusing, and maybe
informative, in any case! :)

Jim

Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.