We're currently performing a cross-page postback using the PostBackUrl
of an asp:Button
:
<asp:Button runat="server" PostBackUrl="processing.aspx" />
which generates this javascript onclick
stuff:
<input type="submit" name="ctl03"
onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('ctl03', ', false, ', 'processing.aspx', false, false))" />
We would like to switch it to use a plain ol' <button runat="server">
(easier to style) however PostBackUrl
is not supported on them.
So I thought: what if simply use said JavaScript in my <button>
element?
<button runat="server" name="ctl03"
onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('ctl03', '', false, '', 'processing.aspx', false, true))">
</button>
And waddayaknow, it works.
Has anyone ever seen this done before? What harm will come to me or my children if I proceed with this?