Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
155
Linkbutton OnClientClick
posted

I have a link button in a templated column in a grid.  In the OnClientClick of the link button I am calling a javascript function which confirms the users action.  If the user cancels the action I want to cancel the postback.  Here is my code however the postback is not cancelled, it still happens.  What am I doing wrong?  I don't want to change to a column of type button since I have one column with 3 link buttons, all different actions and we don't want to change that. I've tried adding "return false" but cannot find anything to make this work.

function confirmDelete(){

var ans = confirm('Are you sure you want to Delete this Account?');

if (!ans) {igtbl_cancelPostBack("<%=accountsgrid.ClientID%>");

}

}