469,963 Members | 1,224 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

2 Forms on one page

Hi all
I have a to different input masks on one page. The first must be posted on
itself, the second must be posted to another website and popup in a new
window. My problem is, ive got one global form tag (index.aspx). The content
comes from different user controls. The two input masks come from 2
different user controls. My global form tag encloses everything between the
<body>-tags. So what i have to do imho, is to identificate which
submit-button was clicked, and change the form attributes. So i have to
change form attributes after a button was clicked, but before the form gets
posted.

Regards Benjamin
Nov 18 '05 #1
5 2808
Hi Benjamin,

The following article might provide some insight:

Form-based Programming in ASP.NET
http://msdn.microsoft.com/msdnmag/is...e/default.aspx

HTH,

--
Scott
http://www.OdeToCode.com

On Mon, 24 May 2004 09:37:49 +0200, "Benjamin Bittner"
<benjamin_bittner[a_t]nospam.web.de> wrote:
Hi all
I have a to different input masks on one page. The first must be posted on
itself, the second must be posted to another website and popup in a new
window. My problem is, ive got one global form tag (index.aspx). The content
comes from different user controls. The two input masks come from 2
different user controls. My global form tag encloses everything between the
<body>-tags. So what i have to do imho, is to identificate which
submit-button was clicked, and change the form attributes. So i have to
change form attributes after a button was clicked, but before the form gets
posted.

Regards Benjamin


Nov 18 '05 #2
Hi!

Scott Allen wrote:
[...]
Form-based Programming in ASP.NET
http://msdn.microsoft.com/msdnmag/is...e/default.aspx
[...]
<benjamin_bittner[a_t]nospam.web.de> wrote:
[..]
change form attributes after a button was clicked, but before the form gets
posted.

Regards Benjamin


Hum but even this doc leaves a great many questions open.

Imagine a typical invoice/order webform which has many buttons to add
remove change items, change the address of the client, recipient address
and payment stuff. This webform is part of an application with 20 other
larger webforms to create address records, items, payments and billing
stuffs etc.

Such an invoice form has many buttons and some of them lead back to the
same form with the same form variables and some lead to other forms,
also with the form variables.

How to make this in SFI ASP.NET?

I m thinking of another solution, but then my question is:

How can I upon receipt of a pressed button event change the whole
"current page/webform context" to another webform and paste my current
scope of form variables to the other webform, which then runs through
its page creation render termination lifecycle? Or because it is already
just fine living in memory simply forward the request there?
Then when somebody presses a button on the invoice form which requires a
redraw of the invoice form it is fine as usual. But when a button is
pressed which leads to another webform, then .... what? Redirect the
webbrowser to another form with a quazillion bytes long URL? Or can this
happen "in memory", on the Server?

Regards,
Philipp

Nov 18 '05 #3
Server.Transfer(string path, bool preserveForm)

Terminates execution of the current page and begins execution of a new
page using the specified URL path to the page. Specifies whether to
clear the QueryString and Form collections.

Parameters

path -The URL path of the new page on the server to execute.

preserveForm - If true, the QueryString and Form collections are
preserved. If false, they are cleared. The default is false .

-Jason

Philipp Ott wrote:
Hi!

Scott Allen wrote:
[...]
Form-based Programming in ASP.NET
http://msdn.microsoft.com/msdnmag/is...e/default.aspx
[...]
<benjamin_bittner[a_t]nospam.web.de> wrote:
[..]
change form attributes after a button was clicked, but before the
form gets
posted.

Regards Benjamin

Hum but even this doc leaves a great many questions open.

Imagine a typical invoice/order webform which has many buttons to add
remove change items, change the address of the client, recipient address
and payment stuff. This webform is part of an application with 20 other
larger webforms to create address records, items, payments and billing
stuffs etc.

Such an invoice form has many buttons and some of them lead back to the
same form with the same form variables and some lead to other forms,
also with the form variables.

How to make this in SFI ASP.NET?

I m thinking of another solution, but then my question is:

How can I upon receipt of a pressed button event change the whole
"current page/webform context" to another webform and paste my current
scope of form variables to the other webform, which then runs through
its page creation render termination lifecycle? Or because it is already
just fine living in memory simply forward the request there?
Then when somebody presses a button on the invoice form which requires a
redraw of the invoice form it is fine as usual. But when a button is
pressed which leads to another webform, then .... what? Redirect the
webbrowser to another form with a quazillion bytes long URL? Or can this
happen "in memory", on the Server?

Regards,
Philipp

Nov 18 '05 #4
You might be able to pull this off with Server.Transfer: this
technique moves processing to another ASPX page without going back to
the client. All of the state you need to pass along can go into the
HttpContext.Items collection.

A couple more articles to investigate this method:

The HttpContext Items Collection
http://odetocode.com/Articles/111.aspx

Passing Server Control Values Between Pages
http://msdn.microsoft.com/library/de...tweenpages.asp

--s

Then when somebody presses a button on the invoice form which requires a
redraw of the invoice form it is fine as usual. But when a button is
pressed which leads to another webform, then .... what? Redirect the
webbrowser to another form with a quazillion bytes long URL? Or can this
happen "in memory", on the Server?

Regards,
Philipp


--
Scott
http://www.OdeToCode.com
Nov 18 '05 #5
Hi!
Scott Allen schrieb:
You might be able to pull this off with Server.Transfer: this
technique moves processing to another ASPX page without going back to
the client. All of the state you need to pass along can go into the
HttpContext.Items collection.
[...]
Passing Server Control Values Between Pages
http://msdn.microsoft.com/library/de...tweenpages.asp


Thank you for the information. I m reading the infos.

Is it possible to have two or more references in the second page, so
that it can be called from two or more pages?

How can I find out which button was pressed into the first page context?
Can I ask the Context.Handler what it has in its bag?
For example:
<%@ Page Language="C#" Inherits="SecondPageClass" %>
<%@ Reference Page="firstpage.aspx" %>
<%@ Reference Page="otherpage.aspx" %>
void Page_Load()
{
public FirstPageClass fp;
public OtherPageClass op;

if (!IsPostBack)
{
fp = (FirstPageClass) Context.Handler;
op = (OtherPageClass) Context.Handler;
}
}

Thank you,
regards,
Philipp
Nov 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by ElmoWatson | last post: by
3 posts views Thread by Kris van der Mast | last post: by
reply views Thread by Anonieko Ramos | last post: by
5 posts views Thread by Gavin Stevens | last post: by
6 posts views Thread by Manny Chohan | last post: by
5 posts views Thread by ~~~ .NET Ed ~~~ | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.