Last Updated:
22 Apr 2019 13:10
by ADMIN
Selected index is not persisted after canceling OnClientSelectedIndexChanging event
I have a few instances where I need OnClientSelectedIndexChanging inorder to stop the listbox selectedIndexChanged event from posting back in certain cases. In those cases I stop it from posting back by setting the e.set_cancel(true);
function CheckForListBoxReorder_OnClientEvent(sender, e) {
if (ListboxReordered()) {
alert('Please save changes to the bus order.');
e.set_cancel(true);
}
}
This works very nicely, but I'm getting many errors because although it looks like it's still selected to the proper row in the listbox the selectedIndex is now -1.