Button click doesn't call function even when button attribute OnClick is set to that function

Posted by Silmaril89 on Stack Overflow See other posts from Stack Overflow or by Silmaril89
Published on 2010-03-19T20:01:01Z Indexed on 2010/03/19 20:11 UTC
Read the original article Hit count: 391

Filed under:

Hi, I have an aspx page with two buttons, one of the buttons has an OnClick attribute to a function that should be run when clicked. When the other button is clicked there is an if statement checking if the page is a postback, if it is then I run some statements that need to be run when that button is clicked. That postback button works fine. However, the other button, when it's clicked the function it's supposed to call never executes, and the statements inside if (Page.IsPostBack) get executed instead. What can I do to fix this? Is there a way to make the button that calls a function not do a Post back?

© Stack Overflow or respective owner

Related posts about ASP.NET