Skaphhowreero
New Member
I'm trying to run some javascript before my button's click event happens on the server side, but the javascript code runs, and the server side code runs right after that no matter what. Here's what I have:\[code\]<script type="text/javascript" language="javascript"> $(document).ready(function() { SubmitClick = function() { if ($("#<%= fuFile.ClientID %>").val() == "") { $("#error").html("File is required"); return false; } } });</script><asp:FileUpload ID="fuFile" runat="server" /><asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClientClick="SubmitClick()" UseSubmitBehavior="false" OnClick="btnSubmit_Click" /><span id="error"></span>\[/code\]I thought that setting \[code\]UseSubmitBehavior="false"\[/code\] and returning \[code\]false\[/code\] in the javascript function would work, but it's not. My error message gets displayed for a second before the server side code runs.What am I doing wrong here?