I have been working with client script using RadButton, and noticed some odd behavior when calling args.set_cancel. During the OnClientClicking event, i check a condition, if true, button is allowed to postback, if false, set_cancel is set to true. I have two buttons using this event.
Now, if I click Button1, and somecondition is false, then the postback will cancel. However, if I click Button2 next, when the OnClientClicking event is fired, somecondition is true, and set_cancel(true) is NOT called, but... the button does not post back. Now if I reload the page and click Button2 first, then it posts back, until i click Button1, then Button2 no longer posts back.
I tried explicitly calling
but it still does not work right.
function OnClientClicking(sender, args) { if (somecondition == false) { args.set_cancel(true); }}Now, if I click Button1, and somecondition is false, then the postback will cancel. However, if I click Button2 next, when the OnClientClicking event is fired, somecondition is true, and set_cancel(true) is NOT called, but... the button does not post back. Now if I reload the page and click Button2 first, then it posts back, until i click Button1, then Button2 no longer posts back.
I tried explicitly calling
args.set_cancel(false); but it still does not work right.
function OnClientClicking(sender, args) {
if (somecondition == false) {
args.set_cancel(true);
} else {
args.set_cancel(false);
}
}
Any ideas what might be causing this weirdness?