History
In our application we created a special (user friendly) window for showing messages to the user. The window will get its data, text, buttons through the args parameter.
We will open this window using the messageBox function (this method lies in one of our JS files).
Challenge
Everyone knows the annoying default alert of ValidationSummary in ASP.NET.
Our messageBox still couldn't rid from the alert that the WebUIValidation.js is popping up on validation error.
Why? Because in this JS, Microsoft simply write alert(msg).
Solution
Today we wrote those simple lines:
window.alert = function specailAlert(msg) {
messageBox("title", msg, button_ok, info_icon);
}
This will cause the JS parser to call our function any time the origin window.alert is running. So from now on, when the ValidationSummary will write alert("some useful message"), our method will replace the ugly gray box with our user friendly window.