ComponentOne TabStrip for ASP.NET AJAX: TabStrip for ASP.NET AJAX Task-Based Help > Setting C1TabStrip Behaviors > Validating Information Before a Tab Switch

Validating Information Before a Tab Switch

TabStrip for ASP.NET AJAX allows you to perform validation checks before tab switches take place. To illustrate this feature, we'll set up a C1TabStrip control so that a tab switch cannot be performed without text being entered into a standard TextBox control.

Complete the following steps:

1.   Click C1TabStrip's smart tag () to open the C1TabStrip Tasks menu and then select TabStrip Designer.

The C1TabStrip Designer Form appears.

2.   Use the Add Child Item button  to add two tabs to your C1TabStrip.

3.   With C1TabStrip1 selected in treeview, set the following properties:

      Set the CausesValidation property to True.

      Set the ValidationGroup property to "PasswordValidation".

4.   Click OK to close the C1TabStrip Designer Form.

5.   Add a standard TextBox control to your project and set its ID property to "PasswordBox".

6.   Add a RequiredFieldValidator control to the form, placing it beneath the TextBox control that you added in the last step. Set its properties as follows: 

      Set the ControlToValidate property to PasswordBox.

      Set the ValidationGroup property to "PasswordValidation".

      Set the Text property to " You must enter text before proceeding".

7.   Run the project.

 This Topic Illustrates the Following:

Once the project is built, click on Tab02 without typing anything into the text box. The result will resemble the following image:

 

 

Now enter text into the text box and click Tab02 again. Observe that Tab02 comes into focus without throwing an error.

 


Send comments about this topic to ComponentOne.
Copyright © 1987-2010 ComponentOne LLC. All rights reserved.