New-UDTabContainer Active Tab?

Hey guys, does anyone know of a way to get the active tab when using New-UDTabContainer / New-UDTab? Using Get-UDElement doesn’t return anything for the container or the tabs.

I need to know which tab is active so that I can capture the correct information for other options in a form.

Cheers :slight_smile:

So I think I’ve answered my own question, inside each tab if you create a New-UDElement with an endpoint and set a session variable corresponding to the tab (e.g. $Session:ActiveTab=“1”), each time you click on a tab it refreshes the element and sets the session variable.

Just thought I’d post that in case anyone else finds themselves in the same predicament!

1 Like

Update on this - this works perfectly… until you put the container inside another UDElement with an endpoint. It runs the code inside the tab when selected but only once. If you then switch back to a tab that has been selected before then it doesn’t refresh. I’ve tried every combination of -RenderOnActive on the container, -RefreshWhenActive and -Dynamic on the tabs themselves. It seems having the container inside another endpoint breaks any refreshing capabilities that it has :man_facepalming:

If anyone has an explanation as to why that would be awesome.