Server.Transfer or Response.Redirect Help

G

Guest

Hi There

I am using frames in an .asp application.

I have a constant Banner across the top (an .htm file), a variable menu down
the left and a main body (both .aspx)

I have added a file search facility in the menu down the left which takes
user input for an account number (in to a text box) and is supposed to
redirect the MAIN page to a customer info screen (on clicking a button in the
menu area) which takes the user input from the menu and OnPageLoad in the
main.aspx displays information about the account they have requested.

All basic stuff.... but I must be a little basic I'm afraid as I can not
work out how a button on the menu.aspx (I'm using OnItemCommand) is supposed
to make the main.aspx redirect rather than itself. At the moment, I enter an
account number and click search and the page appears all sqwidged up in the
menu.aspx area whilst main.aspx remains the same as before. I realise why
this is happening, but is there a way to alter the Server.Transfer to refer
to a different .aspx file than the one the action is in ?

Thanks for your help
 
C

Chris Hyde

Stuart said:
All basic stuff.... but I must be a little basic I'm afraid as I can not
work out how a button on the menu.aspx (I'm using OnItemCommand) is supposed
to make the main.aspx redirect rather than itself. At the moment, I enter an
account number and click search and the page appears all sqwidged up in the
menu.aspx area whilst main.aspx remains the same as before. I realise why
this is happening, but is there a way to alter the Server.Transfer to refer
to a different .aspx file than the one the action is in ?

ASP.NET is not really designed to "post" data from one page to
another...this was really easy in "classic" ASP days, but with .NET
comes the concept of "post-backs" (the page that collects the data POSTs
it back to itself for processing). Along the same lines, ASP.NET is not
really designed to host multiple forms within the same ASPX page either
(although Wilson's Web Forms has over come this limitation).

One thing you could do would be to use a little bit of Javascript, and
change the location of the "main" frame to the page you want to load,
and pass the data in the query string. And, since you are already in a
framed environment, this action should not change the actual URL in your
browser window.

HTH...
Chris
 
K

Ken Dopierala Jr.

Hi,

You will need to do this with javascript. Here is how I change one frame
from a button click on another frame:

Put this in your code behind for the button:

btn1.Attributes.Add("onclick", "LaunchOtherFramePage(); return false;")

Put this in your javascript in the .aspx page that holds the button:

function LaunchOtherFramePage() {
parent.document.getElementById("OtherFrame").src = "NewPage.aspx";
}

This will change the other frame and won't cause a postback on the page
holding the button that changes the other page. Good luck! Ken.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top