I think it's too difficult to do what you want, because user is changing Active Tab on client side, and you have to add hidden field which will track what tab is active. Do you use this in DirectEvent's Handler? If you do, it's much easier to use ExtraParams. Try following code:
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Window win = new Window
{
Height = 250,
Width = 600,
Closable = false,
Title = "Scrollable Tabs",
Layout = "Fit"
};
TabPanel tabs = new TabPanel
{
ID = "TabPanel1",
Border = false,
MinTabWidth = 100,
ActiveTabIndex = 6,
Plugins =
{
new TabScrollerMenu { PageSize = 5 }
}
};
tabs.Add(new Ext.Net.Panel { Title = "Our First Tab" });
int index = 1;
while (index <= 11)
{
Ext.Net.Panel tab = new Ext.Net.Panel
{
ID = "Tab_" + index,
Title = "Tab # " + index.ToString(),
Html = "Tab " + index.ToString(),
Closable = true,
Border=false,
Padding = 6
};
tabs.Items.Add(tab);
index++;
}
win.Items.Add(tabs);
this.Form.Controls.Add(win);
}
/// <summary>
/// Handler for Button DirectEvent Click
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ButtonClickHandler(object sender, DirectEventArgs e) {
string activeTabId = e.ExtraParams["activeTabId"];
if (activeTabId == string.Empty)
{
X.Msg.Notify("Active Tab Id", "No active tab").Show();
} else
{
Ext.Net.Panel activeTab = (Ext.Net.Panel)Form.FindControl("TabPanel1").FindControl(activeTabId);
X.Msg.Notify("Active Tab Id", activeTabId).Show();
}
}
</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>Scrollable Tabs with TabScrollerMenu Plugin - Ext.NET Examples</title>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<h1>Scrollable Tabs with TabScrollerMenu Plugin</h1>
<ext:Button ID="Button1" runat="server" Text="Click me">
<DirectEvents>
<Click OnEvent="ButtonClickHandler">
<ExtraParams>
<ext:Parameter runat="server" Name="activeTabID" Value="#{TabPanel1}.getActiveTab() != null ? #{TabPanel1}.getActiveTab().getId() : ''" Mode="Raw"></ext:Parameter>
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>
</form>
</body>
</html>