fadi Posted September 24, 2003 Posted September 24, 2003 hello again, can anybody tell me how to prevent a postback to the server from havascript. i have a button with a javascript onclick event, if a certain condition is met i dont want to postback to the server, how can i do that Quote
Moderators Robby Posted September 24, 2003 Moderators Posted September 24, 2003 In the function, Return False Quote Visit...Bassic Software
Cathryn Posted November 6, 2003 Posted November 6, 2003 I did that and it doesn't work for me. I don't know if it's because the asp:button is in a graphic control? Quote
Moderators Robby Posted November 7, 2003 Moderators Posted November 7, 2003 Do you have client side script running on the Onclick? Quote Visit...Bassic Software
fadi Posted November 11, 2003 Author Posted November 11, 2003 hello all, just to mention, i previously solved this problem. u need to return the function besides adding a return false in the function ex: function hello() { return false; } in the onclick event of a button put: onclick="return hello();" Quote
fadi Posted November 11, 2003 Author Posted November 11, 2003 just to note, if the control is an asp control, u need to set the onclick event from the server side by placing the line: button1.attributes.add("onclick","return hello();") in the page_load event handler as an example Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.