I need to add some validations before the user navigates away via an ASP.NET Menu.
I noticed that the items are rendered to use a javascript function called Menu_Key
<td id="ctl00_MainMenun1" onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(this)">
I there a way to override that function and have the menu execute one of mine, from which I could validate what I need and then call the original?
Redefine the function after it was initially defined, but keep track of it in a var so that you can call it later. You would effectively be renaming the original Menu_Key function.
var originalMenu_Key = Menu_Key;
Menu_Key = function(t) {
// do your validations here
if ( /* everything validated */ ) {
originalMenu_Key (t);
}
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With