Dynamically enable/disable ASP.Net AJAX controls

The ASP.Net AJAX Toolkit is a good stuff because it can let you achieve some very cool functions without doing too much hard works. However, how to do it if I want the AJAX control works only in some conditions? For example, I want to have the same function like this one. After many times try and error, I finally figure out the correct procedures. Here are the steps:

1. Drag and drop a TextBox onto the page.

2. Drag and drop an UpdatePanel and set up the properties.

3. Drag and drop a button and a ConfirmButtonExtender inside the UpdatePanel. PS: The ConfirmButtonExtender's "Enable" property must set to True.

4. Set the ConfirmText.

5. Here is the key point: In the Page Initial process, set the ConfirmButtonExtender's "Enable" property to False. We then enable the control inside the TextChanged event.

6. After following these steps, we can do exactly the same thing as this one without writing any javascript codes.

1 comment: