Creating ASP.NET forms, that act like HTML forms

J

jlopes151

Question:

I'm creating an ASP.NET webform and I have questions about how the
ASP.NET form works. In ASP or
HTML a form with an action will transfer that forms items to another
page.

From the documentation I have read, there is nothing that describes
the use of the forms action
atribute. I did find text on the MSDN that describes the use of
Server.Transfer and Response.Redirect.

A simple Submit use of the "action" attribute doesn't seem to exist.

Is there a default way to submit a webform in ASP.NET as in HTML or
ASP? Yes I can store the form
data in a class, store the class in the session, retrive it from the
session as needed.


Thanks for any help :?
 
B

Brock Allen

Forms in ASP.NET postback to the same page that rendered them so you can
take advantage of the object model. When you postback all of the server side
controls are recreated and repopulated with the values that are posted back
to the page. This provides for a much higher level programming model, and
therefore makes you as the developer more productive.

Now, if you really want to post to a second page, you can. But then you're
back to [old] ASP style Request.Forms programming.

As an aside, in ASP.NET v2.0 you can do a cross page postback without sacrificing
the ASP.NET object model.
 
S

Steve C. Orr [MVP, MCSD]

Setting the action attribute just isn't the ASP.NET way.
If you really must do it though, here are some tips:

1) Output an old fashioned non-server form to the client (without the runat=
'server' attribute) Set the action attribute like you would have in
ASP.OLD, and use javascript to submit the form.
2) use client side script to change your ASP.NET form action attribute
3) use this webform control: http://www.wilsondotnet.com/Controls/

Note: In ASP.NET 2.0 you will be able to more easily post to another page.




jlopes151 said:
Question:

I'm creating an ASP.NET webform and I have questions about how the
ASP.NET form works. In ASP or
HTML a form with an action will transfer that forms items to another
page.

From the documentation I have read, there is nothing that describes
the use of the forms action
atribute. I did find text on the MSDN that describes the use of
Server.Transfer and Response.Redirect.

A simple Submit use of the "action" attribute doesn't seem to exist.

Is there a default way to submit a webform in ASP.NET as in HTML or
ASP? Yes I can store the form
data in a class, store the class in the session, retrive it from the
session as needed.


Thanks for any help :?
 

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,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top