I recently developed a unique web control that performs client-side validation on text input within a textbox. This custom web control includes embedded JavaScript as a resource, which triggers a confirm alert box during the validation process.
My goal is to allow users to customize the message displayed in the alert box by setting it through a property of the web control, similar to how standard ASP.NET validation controls use the ErrorMessage property.
If anyone has suggestions on the best approach to integrate this property into my existing embedded JavaScript function, I would greatly appreciate your advice.
Snippet from Embedded JavaScript Function
function checkDeduction(sender, eventArgs) {
var dNewVal = eventArgs.get_newValue();
if (dNewVal > 0) {
var bRetVal = confirm("custom msg here");
if (!bRetVal) {
dNewVal = dNewVal * -1;
sender.set_value(dNewVal);
}
}
}