UltraWebTab: Switch to Tab on Validation Error

The Problem

I have an ASP.Net form that contains a set of tabs hosted inside an Infragistics UltraWebTab control. Each tab contains a number of fields that have validation. Sometimes, when the user submits the form, a validation error occurs. When this happens, I want the user to be able to correct the error with a minimum of fuss – I want the tab containing the error to be automatically selected, and the control with the error to be given the focus.

The Solution

The following code causes the first tab that contains an error to be selected when the form submits:

To run the script, attach it to the OnClientClick event of the button that submits the form.
Note that validation of each control will happen twice if the form is valid; once for the code above and then once because that’s how ASP.Net works. This doesn’t normally matter with the standard ASP.Net controls, but it might be an issue with badly-written custom validation controls. You have been warned!

MS Ajax Tab Control: Index of the Tab Containing a Control

The Problem

I have an Ajax Tab Container that contains several tabs. On one of those tabs, I have a control. On the client, how do I find out which tab contains the control?

The Solution

Here is the JavaScript function that I used to solve this problem. In the following code, my tab container is called “Main_TabContainer”.

GridView Buttons not Working?

In my experience, the most common reason for Buttons in a GridView not working is that data is being bound to the GridView during the postback.

In other words, the code looks something like this:

When it should look like this: