473,406 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Form action attribute unchangeable?

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

Nov 17 '05 #1
2 9673
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
"belgie" <be****@hns.com> wrote in message
news:O6**************@TK2MSFTNGP11.phx.gbl...
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

Nov 17 '05 #2
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.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows XP
Windows XP Associate Expert
--
"belgie" <be****@hns.com> wrote in message
news:O6**************@TK2MSFTNGP11.phx.gbl...
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

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bruce Duncan | last post by:
I'm new to PHP...and my previous post was a bit premature. I've narrowed my problem down to this: I have this very simple form in test1.php <form name='formx6' action="testz.php?varxy=1">...
13
by: dogu | last post by:
Noob alert. Code is below. File is saved as a .php. What I'm trying to do: User uses 'select' box drop down list to pick a value. Value ($site) is derived from a db query. This works fine....
4
by: Sarah | last post by:
Hi all. I have a form, and several text and image links on it that should submit the form with different actions. I prepared a simple page with just the code that's not working. PROBLEM:...
5
by: Jan Gregor | last post by:
Hello I want to change attribute action in form. Problem is that in that form is also input with name action. Unfortunately renaming of that input is worst case because many servlets depend on...
10
by: iam247 | last post by:
Hi In my prototype asp page (with no javascript and no password validation, I have a registration form with the following action: <form name="form" method="post" action="RegDetails.asp"> ...
3
by: Don Parker | last post by:
I am a newbie to ASP.NET. I am converting some asp pages I had working. I have a page which has a form with several input elements. When the user clicks on a Submit element - the action specified...
13
by: johnemmatty | last post by:
I am using an asp page in which i dynamically fill the ACTION property of the form. The problem is that whenever i try to redirect to a html page using the javascript:location, it is getting...
4
by: wwwmike | last post by:
How can I overwrite the <FORM action=attribute? I can add new attributes with Dim xx As System.Web.UI.HtmlControls.HtmlForm xx = Page.FindControl("form1") xx.Attributes.Add("something",...
4
by: Roshawn | last post by:
Hi, I have a web page that contains an html form and has a few controls in it. The html form and its controls are all server controls. However, I've set the enableViewState attribute of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.