Site icon Tech blog with tips, tricks and hacks

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

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.

Exit mobile version