Link to home
Start Free TrialLog in
Avatar of wahooo
wahooo

asked on

__doPostBack problem for login

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:
<form>
   <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" />
</form>

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?
ASKER CERTIFIED SOLUTION
Avatar of royend
royend
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Kiran Paul VJ
Kiran Paul VJ
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forced accept.

Computer101
EE Admin