I need to do some client-side validation and calculation before submitting a form, while still being able to benefit from the .NET-functionality. Therefore I tried to use the __doPostBack in order to first do my client-side calculations before triggering a .NET-button. But something is wrong...
This is a simplified code:
<asp:textbox id="text1" enabled="false" runat="server" />
<asp:textbox id="myText" enabled="true" CssClass="hidden" runat="server" />
<asp:button id="btn1" OnClientClick="this.form.myText.Value = this.form.text.Value; __doPostBack('btn3','');" runat="server" Text="Click me" />
<asp:button id="btn2" OnClick="myNetFunction" runat="server" Text="not visible" CssClass="hidden" />
The CssClass "hidden" is basically just a display:none to make it not visible, but still visible to use.
Ok, normally when I submit a valid form I get a confirmation message, and if the submitted form is invalid I get an error message. When I push the btn1 now it only processes some data, before refreshing the page and presenting me with a form (which includes the text in text1)... no response at all.
Do you know what I have done wrong?