There are two ways of doing it
1. In the ASPX markup, you can use OnClientClick attribute to wire-up a JavaScript event to an ASP.NET button.
<asp:button id="btnSubmit" onclientclick="return ValidatePage();" xmlns:asp="#unknown"></asp:button>
2. In the code-behind, you can use code like this:
btnSubmit.Attributes.Add("onclick", "return ValidatePage();");