Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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
  • 1 month later...
Posted

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();"

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...