Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is PostbackUrl equivalent to Form.Submit?

Tags:

html

asp.net

I inherited an application that used forms to POST data. I am not very familiar with Form behavior. To me, this is an arcane method of doing a POST. Plus, these forms break hardcore when converted to MasterPages because of Forms Nesting.

So I am refactoring, trying to minimize the dmg I'm doing. Are these two functionally equivalent?

Original method

<form id="transferForm" action="TransferSave.aspx" method="post">
<input type="button" id="Button2" class="button" onclick="transferForm.submit();" value="Review Transfer"/>

New way

<asp:Button ID="submitBtn" runat="server" class="button" Text="Review TransferX" PostBackUrl="TransferSave.aspx" />

I tested the new method and it worked. I just want to be sure that what I am doing doesn't create some nutty problem that I am unaware of. Mainly because I just don't feel like a master of html forms.

like image 296
P.Brian.Mackey Avatar asked Oct 17 '25 07:10

P.Brian.Mackey


1 Answers

Is some different... At First PostBackURL does post to the same page and then redirects sending the form values, but not only the values you desired, ALL CONTROLS are sended...

like image 81
Alberto León Avatar answered Oct 19 '25 21:10

Alberto León