2 Forms on one page

  • Thread starter Thread starter Benjamin Bittner
  • Start date Start date
B

Benjamin Bittner

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
 
Hi!

Scott said:
[...]
Form-based Programming in ASP.NET
http://msdn.microsoft.com/msdnmag/issues/03/05/CuttingEdge/default.aspx
[...]
[..]
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
 
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 said:
Hi!

Scott said:
[...]
Form-based Programming in ASP.NET
http://msdn.microsoft.com/msdnmag/issues/03/05/CuttingEdge/default.aspx
[...]
[..]
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
 
Hi!


Scott said:
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/d...conpassingservercontrolvaluesbetweenpages.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
 
Back
Top