DropDownList SelectedItem.Value or SelectedValue not working when TabPanel is removed

5 June 2009

If you’re using the TabContainer, which is part of the Ajax Control Toolkit and have noticed that when you remove a tab you have issues accessing the values from a DropDownList using .SelectedItem.Value or .SelectedValue then below is the solution:

Instead of using the below to remove a tab:

TabContainer1.Tabs.Remove(TabPanel1)

Use this code to remove the tab instead:

TabContainer1.Tabs.Item(0).Visible = False

As you can see, you need to state the index rather than the id, but just remember that indexes start at 0.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.