posting to another aspx page

M

Magnus

Hi!

This is my problem:

I want to go from page1 to page2,
and to get all the form variables from page1
to page2.

I have turned the viewstate and the sessionstate off,
and i really just want to get these variables the
oldfashioned way (ie via the request.form collection)

This is how im trying to do this:
I have a javascript that fires on page1 that
changes the action of its form to page2 and then submits
the page.
//page1 javascript
function test()
{
Form1.target="_blank";
Form1.action="page2.aspx";
Form1.submit();
}


but when i get to page2, the form collection
from page1 is gone...
+ the request object says i used method=GET...

can someone help me out here plz
 
J

James J. Foster

If you are using standard html controls in that form, you can remove the
runat=server attribute to treat it as an old-fashioned, "classic" form. Then
set the action attribute to your new form.
 
C

Cowboy \(Gregory A. Beamer\)

There are a couple of ways to do this. For a form post, switch the form in
question back to a standard HTML form and then pull from the request
collection. It is also possible to transfer on the server and use viewstate
to pull data (and better in a truly .NET enable environ).

In your example, you would be best to either make the paradigm shift to .NET
(ie, form and handler in same page (can be done rather easily with
containers like panels)) or switch the form to a client side standard HTML
form and pull from request.
 
M

magnus gudmundsson

thanx, but, my problem is more complex than that.
check this out:
page1
|_| -> A couple of buttons, that do the ordinary
postback .net stuf

->but for one button I want the user to stay on the
current page +send the form information to a separate page
in another browser window.

ie its not just a question of processing the data in
another webform, but keep the old form alive,
and get another one started.

Page2 is an excel presentation of the data in page1,
and i want the user to be able to look att both
at the same time.

the first way (standard HTML form)
sounds like a lot of hassle as I have a table
that i build dynamically, containing a couple of
servercontrols
It might be possible, but surely
there must be a simpler way to make page2 treat the request
as a post request and not drop the form variables?
 
N

Natty Gur

Hi,

Use the Form target attribute :

<form target="_blank" id="WebForm2" action="WebForm3.aspx"
method="post">
<INPUT name = "a" style="Z-INDEX: 101; LEFT: 121px; WIDTH: 182px;
POSITION: absolute; TOP: 83px; HEIGHT: 31px" type="text" size="25">
<INPUT name = "b" style="Z-INDEX: 102; LEFT: 126px; WIDTH: 171px;
POSITION: absolute; TOP: 135px; HEIGHT: 33px" type="text" size="23">
<INPUT style="Z-INDEX: 103; LEFT: 166px; WIDTH: 88px; POSITION:
absolute; TOP: 216px; HEIGHT: 38px" type="submit" value="Submit">
</form>

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top