PDA

View Full Version : [FIXED] [V0.6] TabPanel and SetActiveTab



Timothy
Sep 07, 2008, 3:28 PM
Hello,

Just found a problem with using the TabPanel SetActiveTab I'm wondering if it has something to do with the new work done on the TabPanel class.

Example.aspx:


<%@ Page Language="C#" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected override void OnInit(EventArgs e)
{
Control control = Page.LoadControl("Example-Control.ascx");

UserControl.Controls.Add(control);

base.OnInit(e);
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" />
<ext:ScriptManager ID="ScriptManager2" runat="server" />
<asp:PlaceHolder ID="UserControl" runat="server" />
</form>
</body>
</html>


Example-Control.ascx:


<%@ Control Language="C#" ClassName="Example_Control" %>

<script runat="server">
protected void btnDemo_Click(object sender, EventArgs e)
{
Tabs1.SetActiveTab(Tab2);
}
</script>
<ExtJS:TabPanel ID="Tabs1" runat="server" ActiveTabIndex="0" AutoPostBack="True" AutoHeight="True" AutoWidth="True" DeferredRender="True">
<Tabs>
<ExtJS:Tab ID="Tab1" runat="server" Title="Tab1" AutoHeight="True" AutoWidth="True">
<Content>
<ExtJS:Button ID="btnDemo" runat="server" AutoPostBack="True" &#111;nclick="btnDemo_Click" Text="Switch it" />
Tab 1
</Content>
</ExtJS:Tab>
<ExtJS:Tab ID="Tab2" runat="server" Title="Tab2" AutoHeight="True" AutoWidth="True">
<Content>
Tab 2
</Content>
</ExtJS:Tab>
</Tabs>
</ExtJS:TabPanel>


Replication steps:

1. Load page
2. Click "Switch it"
3. Note exception regarding Tab2 does not belong to Tabs1 TabPanel

Cheers,
Timothy

Timothy
Sep 07, 2008, 3:36 PM
Found the fix:

TabPanelBase.cs:491


public virtual void SetActiveTab(Tab tab)
{
this.SetActiveTab(tab.ClientID);
}


Should be:



public virtual void SetActiveTab(Tab tab)
{
this.SetActiveTab(tab.ID);
}


Cheers,
Timothy

Timothy
Sep 10, 2008, 8:35 AM
This is fixed in SVN, you can mark fixed!