Click here to Skip to main content
15,887,446 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Experts,

I am Doing an asp.net project. And i am stuck with html button with serveronclick function.

I have Created OnServerClick event in html button..

And i have used jqueryValidationEngine for validation the form. But when i add the Onserverclick event in HTML button then the page postback occured. i can't validate the form .

Please help me to solve this issue..

ASP.NET
<button id="btnSave" class="button glossy mid-margin-right" runat="server" onserverclick="btnSave_Click">
                            <span class="button-icon"><span class="icon-tick"></span></span>
                            Save Student
                        </button>


Thanks

Dileep
Posted

1 solution

Use like...
XML
<asp:Button runat="server" OnClick="btnSave_Click" OnClientClick="return ValidationFunction();" Text="Save Student" />
 
Share this answer
 
Comments
dilzz 28-Jan-14 10:07am    
Thanks for your reply...
I can't use asp button. b'coz i didn't get the style. My web template have used the desing in html button.. something like..

<button id="btnSave" class="button glossy mid-margin-right" runat="server" önserverclick="btnSave_Click" >
<span class="button-icon"><span class="icon-tick"></span></span>
Save Student
</button>

Here the designed used some span inside the button. we can get this design when we used the span inside the button.. thats y.
You can add one CssClass property to the Button and assign all the CSS properties to it. It might work.
Try like below...

<asp:Button runat="server" OnClick="btnSave_Click" CssClass="button glossy mid-margin-right button-icon icon-tick" OnClientClick="return ValidationFunction();" Text="Save Student" />

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900