Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
325
TabItemClosed not firing
posted

Hi all,

I'm evaluating Infragisitcs controls for a number of projects I'm about to start heavily working on, and I'm having problems with dynamically created tabs (with the tab control set with viewstate on), not firing the TabItemClosed event when a tab is closed.

I've tried by setting the TabItemClosed event in both markup and code behind, and still I'm not able to get the event to fire.

 

Markup:

   

<ig:WebTab ID="documentTabs" runat="server" Height="100%" Width="100%" OnTabItemClosed="documentTabs_TabItemClosed">      

<Tabs>      

</Tabs>

</ig:WebTab>

 

Page Load:

 

protected void Page_Load(object sender, EventArgs e)

            documentTabs.SelectedIndexChanged += new TabSelectedIndexChangedEventHandler(documentTabs_SelectedIndexChanged);

            documentTabs.CloseButton.Enabled =true;

            documentTabs.CloseButton.ImageUrl = "~/Styles/Images/delete2.png";

}

 

       

Method for creating the tabs:

private void RenderTab(Document selectedDocument, bool initialRender, int tabIndex)

        {           

ContentTabItem specifiedTab = null;           

if (initialRender)

            {

                specifiedTab = documentTabs.Tabs.Add();

                tabIndex = specifiedTab.Index;

                documentTabs.SelectedIndex = tabIndex;

            }          

else

            {

                specifiedTab = documentTabs.Tabs[tabIndex];

            }

            specifiedTab.Text = selectedDocument.Title;

        }

 

TabItemClosed handler:

protected void documentTabs_TabItemClosed(object sender, TabItemEventArgs e)

{

}

 

This must be a fairly basic implementation, so I'm struggling to understand why this doesn't work?

Can anyone shed any light as to why this would be, as the documentation is of no help... :(

Parents
No Data
Reply
  • 325
    Verified Answer
    posted

    I thought that the SelectedIndex event was firing, but turns out it wasn't and so I got to a little more investigation and worked out that you need to set the AutoPostBackFlags.

    <AutoPostBackFlags SelectedIndexChanged="On" TabClosed="On" />

Children
No Data