title: Juice UI Tabs in ASP.NET - How to get active tab ID in code-behind
body: <p>I'm using Juice UI tabs functionality in ASP.NET, building the tabs dynamically in code-behind, and finding that I can't get the index/ID of the active tab when OnActiveTabChanged is called. So here's all I have in my ASPX page:</p>
  
  <pre><code>juice:Tabs ID="dataTabs" runat="server" AutoPostBack="true" OnActiveTabChanged="dataTabs_ActiveTabChanged" /
  </code></pre>
  
  <p>And when dataTabs_ActiveTabChanged fires, I can't find a single property that actually has the index/ID of the tab that's been selected. Both dataTabs.Active and dataTabs.Selected are always 0</p>
  
  <p>I need to take some action server-side when a given tab is selected, but to do so, need to be able to tell which tab was actually clicked. I've played around with various jQuery script on the client side to set a hidden object to the value of the tab (tested activate and beforeActivate events) but they never fire (placed alerts inside the jQuery functions that never trigger), which I assume is because I'm running the control server-side?</p>
  
  <p>EDIT: adding a sample of my code-behind as requested</p>
  
  <p>Here's essentially how I'm populating the tabs when the page loads:</p>
  
  <pre><code>protected void loadAndPopulateTabs()
      {
          Juice.TabPage utilityTab = new Juice.TabPage();
          utilityTab.Title = "Utilities";
          utilityTab.ID = "utTab";
  
          string utilTabText = "sometext";
          dataTabContent dtcUT = new dataTabContent(utilTabText);
  
          utilityTab.TabContent = dtcUT;
          dataTabs.TabPages.Add(utilityTab);
  }
  </code></pre>
  
  <p>And currently the code-behind for my OnActiveTabChanged handler is fairly empty whie I play around to see what property I can use to get the selected tab:</p>
  
  <pre><code>protected void dataTabs_ActiveTabChanged(object sender, EventArgs e)
  {
     int currentTab = dataTabs.Active;
  }
  </code></pre>
  
  <p>I'm basically using that one line to break on to see if I can find a way to get anything that would tell me what tab was selected (sender.Active also always shows 0)</p>
  
  <p>Thoughts?</p>