Sinan Türemiş
Sinan Türemiş

Reputation: 115

How to avoid postback with javascript

Content of my page is:

<form id="form1" runat="server">
    <div>
        <asp:TextBox ID="txtAccountNumber" runat="server"></asp:TextBox>
         <asp:Button ID="btnTransfer" runat="server" Text="Transfer" OnClientClick="ValidateTheAccountNumber()" />
    </div>
</form>

I wrote this script:

function ValidateTheAccountNumber() { return false; }

I think, with this js function, the page can't postback.But it does.Please say me what is the wrong point that I do?

Thanks!

Upvotes: 0

Views: 202

Answers (1)

adeneo
adeneo

Reputation: 318342

You have to return the result of the function call as well

... OnClientClick="return ValidateTheAccountNumber()" />

Upvotes: 2

Related Questions