Skip to main content
Solved

How to know currently selected Tab in code level?

  • November 18, 2024
  • 3 replies
  • 59 views

Forum|alt.badge.img

Hi Community,

Can you please help me with the sample to know which tab is selected.

 

Best answer by Dmitrii Naumov

@nsmith51 I don’t think this data is transferred to the backend. So, I don’t think there is a way. 

 

@Mary06 this is not a correct code.

View original
Did this topic help you find an answer to your question?

3 replies

Mary06
Freshman II
  • Freshman II
  • 6 replies
  • November 18, 2024

Hello ​@nsmith51,

 

To find the currently selected tab in code, you can use the PXTab control. In your graph, override the RowSelected event and access the SelectedTab property of the tab control.

The example could be:  

```csharp
protected void YourDAC_RowSelected(PXCache cache, PXRowSelectedEventArgs e)  
{  
    if (e.Row == null) return;  
    var tabControl = PXPage.GetControl<PXTab>("YourTabControlID");  
    if (tabControl != null)  
    {  
        string selectedTab = tabControl.SelectedTab;  
        PXTrace.WriteInformation($"Currently selected tab: {selectedTab}");  
    }  
}
```  

Also make sure the tab control in your ASPX file has a proper ID:  
```xml
<px:PXTab ID="YourTabControlID" runat="server">
    <Items>
        <px:PXTabItem Text="Tab1" />
        <px:PXTabItem Text="Tab2" />
    </Items>
</px:PXTab>
```  
Deploy the changes, and this will let you track the active tab dynamically. Hope it helps


Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • 629 replies
  • Answer
  • November 18, 2024

@nsmith51 I don’t think this data is transferred to the backend. So, I don’t think there is a way. 

 

@Mary06 this is not a correct code.


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2751 replies
  • November 18, 2024

Thank you for your input @Dmitrii Naumov!

@Mary06 you may have used AI to assist with your response. If so, please note the below. Thank you!

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings