I have a page with one form (i.e. a element that submits data to a page) and several ASP controls. The ASP controls must be wrapped in a form tag with runat="server", despite the fact that they have nothing to do with submitting data and the extraneous form tag is worse than useless. This form must encompass all of the controls, which means that it will also encompass the tag of the actual form doing useful work.
This form has a method of get and an action of not-this-page, neither of which plays nicely with ASP. I tried nesting the proper form tag inside the ASP boilerplate, but the browsers won’t take it, probably because it’s expressly prohibited by the spec. The fields of this form are generated via Javascript, so they can’t be turned into ASP controls.
Things that would solve this problem:
- Multiple useless ASP forms per page, so that they can be tightly scoped. (Prohibited by ASP)
- Nested forms, so that the functional one can still exist (Prohibited by HTML)
- A new control that can take the place of the vacuous ASP
formwithout dumping useless crud into the markup. (Is this possible?) - Removing the tag from the useful form and manually going through the POST data on postback to figure out what should be submitted as a GET, then redirecting. On every page with a useful form.
- A complicated system of doing the above semi-automatically, which may be impractical given that the form fields will not be ASP controls.
- Abandoning ASP controls entirely.
Ideas?
A new event handler:
And in the aspx: