Form action attribute unchangeable?

  • Thread starter Thread starter belgie
  • Start date Start date
B

belgie

Whereas in Asp I could submit my form contents to any other Asp page, it
appears that in Asp.NET the primary Asp form will only submit to itself.

I have tried changing the Action attribute in the Form tag, but it changes
itself back when compiled.

I have also tried changing the form Action attribute in client-side
javascript prior to submitting the form, but I get this error:
The View State is invalid for this page and might be corrupted.

I can pass the form collection to a different Asp page by creating
properties in the page module and using Server.Transfer. I can also do it
using client-side logic, by creating a second form on the page with whatever
Action attribute I desire, and copy the data from the primary form to hidden
controls on the secondary form before submitting it.

Am I correct that there is no simpler way of accomplishing what was a common
task in old Asp?

I am otherwise happy with ASP.NET so far. I can manage my interface in a
single page, but it is a lot of panel moving and hiding. (I have found the
best way to do this is with an HTML Grid Layout panel, with the RunAt
property set to Server.)

Please let me know if it seems I have overlooked something.

Thanks!
Bill
 
Belgie,

This is a trade off that was made in order to bring web programming into the
modern world of object oriented programming.

It took me a while to get used to it too...

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
You can change this behavior to submit to another page by removing the
runat="server" attribute from the form tag. However, you then lose the
ability to work with web controls.

With ASP.NET, you work with declared controls and inheritance. The post back
can then be used to read from these same controls and take some action. It
is a fundamental difference in how you construct your applications - once
you get used to it, it seems very natural. You react to events. You may not
want to post to another form yet - you may have validators that you want to
run before you leave that page, and you can't trust that this happens in
client side code.

If you have several pages, don't forget that you can also response.redirect
and server.transfer, rather than having to use panels and such.

Also, you have the ability to dynamically load controls. I have quite a few
applications that consist of a single aspx page, and the content is
determined by which ascx pages I have loaded into it at a given time. You've
just got to think about things a little bit differently.
 
Back
Top