Multiple Forms: Alternatives

C

CJM

I have a page that currently (and foolishly) has two forms... I'm coming
from an ASP Classic background, so I'd completely forgotten about the one
form limitation.

So I need to redesign it in some way... but how? I can imagine a number of
approaches and I've read about some approaches, but I haven't come across
clearly-the-best option.

Specifically, I have a form that gathers user information, and upon
postback, stores that information in a DB. When the form is posted back,
another form is also made visible - this form posts to Paypal and so doesn't
necessarily have to be a server-side form. However, I'm wanting to
dynamically alter certain form fields depending on the user input, so in
order to manipulate these fields (in Form_Load, upon Postback) I need to
set runat="server".

I'm still testing and debugging, but I would assume the server is going to
complain about this second form? Can I manipulate certain fields without
setting the whole form to runat="server"?

If this is going to be a problem, what is the best solution?

I can quickly think of 3 alternatives:
- either merge the forms together and alter the target upon Postback, or
dynamically replace one with the other,
- dynamically write the content of the Paypal form upon postback [actually,
is this possible??]
- redirect to a different page after the details have been written to the
DB.

Rewriting the form(s) sounds messy, but redirecting to a different page
sounds long-winded and inefficient. So I'm hoping that one of you guys can
wave your magic wand and present me the simple, neat and all-too-obvious
killer solution that I've been missing...

Any thoughts?

Thanks in advance.

Chris

PS. Yes, this is my first industrial strength ASP.NET app... in case you
couldn't tell!
 
B

bruce barker

you have a couple options. one, switch to the mvc framework which supports
more than 1 form. second, use two placeholders, one for the <form ...> and
one for the </fom>.

-- bruce (sqlwork.com)
 
C

CJM

bruce barker said:
you have a couple options. one, switch to the mvc framework which supports
more than 1 form. second, use two placeholders, one for the <form ...> and
one for the </fom>.

-- bruce (sqlwork.com)

I realise that MVC is flavour of the month, but it's probably too much of a
learning curve for the time I have available for this project, but it's on
the to-do list along with LINQ.

What do you mean by two placeholders?

Thanks

Chris
 
C

CJM

CJM said:
What do you mean by two placeholders?

Do you mean simply have the Form tags in the master page, and then depending
where we are in the page cycle, either rendering the information gathering
form or the PayPal form?
 

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

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top