Thursday, March 29, 2012

Please Fix Form Post in Whidbey

I used to have forms like this that would post the information to the next website (listed in Action). This simple task has become onerous in VS.NET. Please please come up with a simple correction for this! Maybe a new control or something? I've seen some commercial controls attempt to use server transfer (not quite what I wanted). I've also tried doing it myself, but the next page will never display and it needs to because it has the result in HTML format! Come on...this was a 5 second deal in HTML and weeks in ASP.NET!!!!

<form method=post action="https://website">
<font size=+1>Special Order</font><br>
<input type=hidden name="PartNo" value="S-001">
<input type=hidden name="Item" value="Special Order">
Price: $<input type=text name="Price" value="0" size=10>
<input type=hidden name="Price" value="m-Price;10">
... and so on

</form>You can now in Whidbey add a PostTargetUrl attribute to the buttons control. When you press a button that has the PostTargetUrl attribute specified, the page will post the data to the specified target.

<asp:Button … PostTargetUrl="MyPage.aspx" …>
There are several ways to post to other urls in v1.* today:
(1) Use regular <form> tag, without any runat=server attribute or controls.
(2) Use javascript to change the server form's action attribute on the fly.
(3) MetaBuilders.com has a free custom server form with action enabled.
(4) My WilsonWebForm enables both action and multiple server forms.

0 comments:

Post a Comment