-1

I have a asp.net button like this

 <asp:Button ID="btn" runat="server" Text="txt" OnClientClick="return abc()" />

and javascript function like this

function abc() {

    return false;

}

the problem is on client click the page is posting to the server even when I am returning false in my javascript function.

Any help will be appreciated, thanks

Matt Burland
  • 44,552
  • 18
  • 99
  • 171
user3411907
  • 21
  • 1
  • 1
  • 4

1 Answers1

1

Are you using the javascript tag to define the javascript function?

try this, this should work.

<script type="text/javascript" language="javascript">
function abc() {
    console.log("inside javascript function abc");
    return false;
}
</script>

Note I am trying to print some message in console just to make sure that yeah function is getting called or not.

786543214
  • 855
  • 4
  • 14
  • 29