Ok, here's the situation. I have an .aspx page with two buttons.

Based on the actions going on in the form, one of the two buttons will be invisible.

In my VB code-behind, I set an attribute for each button on the form so that when clicked, the button will become disabled while the user is redirected to another page.

This works fine and good, except for the validation. For instance, if someone does not type in a first name, they will get an error message saying it's a required field. However, the button is still disabled.

To get around this problem, I just set the "onKeyUp" attribute of the text box to re-enable the button. Problem solved right? Wrong.

Now I have an even bigger problem. ASP.Net will only let me specify the "onKeyUp" event once in a tag. So, if the "Submit" button raises client validation, I can type in a valid value and the button is re-enabled. However, if the submit button isn't shown, since the user is in edit mode, the "Edit" remains disabled even if a valid value is in the textbox, because I've only been able to set the onKeyUp for the "Submit" button.

Anyone know how I can overcome this obstacle? It's really frustrating. I'm pretty sure I will have to come up with a Javascript function of some sort, and pass in the button I want re-enabled, instead of just defining it explicitly, but I'm in desperate need of help.

Oh, and mods feel free to move this to the Javascript forum if necessary. I didn't know whether to put it in the ASP.Net forum or Javascript.