Jquery UI Button Server + Client Click Handlers

547 Views Asked by At

I am trying to write a simple HTML form using asp.net and Jquery UI but am running into a problem when trying to process click event handlers on a button within this form. I was tryign to use OnClientClick and OnClick but once the clientside method gets accessed and returns the boolean the server side method is not called accordingly( not called at all actually) Linky to code since I could not get the code tags to work properly: http://pastebin.com/LZNMqASt

2

There are 2 best solutions below

0
On BEST ANSWER

For some reason the return type of the javascript method was not being accepted as a valid boolean. The below solution fixes the OnClientClick event

<asp:Button runat="server" ID="btnLogin" Text="Login" OnClick="btnLogin_OnClick"
                    OnClientClick="if(ValidateLoginForm() != true) return(false);" UseSubmitBehavior="False" />
3
On

I found the problem, Actually you are displaying "div#loginForm" element in to the dialog and its not taking the form element.

Put form element inside of "div#loginForm" container and the problem will be fixed.