Reputation: 915
Hey guys I'm running into a weird issue.. Basically, a user logs into a page and based on his role status(admin or user) determines how many tabs he sees in a tabcontainer. If he is just a "user" then tab index 0 and 1 need to be hidden because they contain admin only functionality.
Doing this is simple:
if(user)
{
Container.Tabs[0].visible = false;
Container.Tabs[1].visible = false;
}
However the problem is if I set more than 1 tab index to visible = false the entire container disappears. Could this be a bug? I know you can only have one tab visible at a time.
Is there a fix? Or should I use a multiview?
Thanks, Josh
Upvotes: 0
Views: 1696
Reputation: 915
Container.Tabs[0].enabled = false
this is the best solution I've come up with...
Upvotes: 1
Reputation: 19852
It appears this might be a bug with the Ajax Control Toolkit, I tested with the latest version (.net 3.5) and was able to reproduce the problem. It seems the toolkit doesn't like it when you set tab 0 to visible, the number of other visible/invisible tabs doesn't matter.
I would suggest that you work around this by doing:
if(user)
{
Container.Tabs.Remove(0);
Container.Tabs.Remove(1);
}
This has the same effect, and since your tabs are defined via the ASPX markup doing a postback without the remove calls will result in your tabs reappearing (if you needed to reshow them for some reason).
Upvotes: 1