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
523
SelectedIndexChanged Not Firing after first click
posted

I have my webtabs set to.

<

 

PostBackOptions EnableAjax="True" EnableLoadOnDemand="True" />

and the SelectedIndexChanged event fires the first time i click each tab, but it never fires after the first click, so if I go back to the first tab or a tab I have click it doesn't fire.  How can I make it fire ever time the tab is clicked?

Parents
  • 380
    Suggested Answer
    posted

    I had a similar problem, the SelectedIndexChange event would trigger fine when moving from tab 1 to tab 2 or tab 3, but when I clicked back to tab 1, no event is triggered. Here is the PostBackOptions that I used:

    <ig:WebTab ID="WebTab1" ... >

        <Tabs> here I had 3 simple template tabs configured  </Tabs>

        <PostBackOptions EnableReloadingUnselectedTab="true" EnableAjax="true" 

    EnableLoadOnDemand="false" />

    </ig:WebTab>

    And here is the code behind with the problem:

     

    protected void Page_Load(object sender, EventArgs e)  {

            WebTab1.SelectedIndexChanged += new TabSelectedIndexChangedEventHandler(TabChanged);

     }

     protected void TabChanged(object sender, TabSelectedIndexChangedEventArgs args) {

            // Logic here

      }

     

    Here is how I solved it - I created my own event handler using the same PostBackOptions: 

     

    protected void Page_Load(object sender, EventArgs e)    {

            int WebTab1SelectedIndexOld = (int) (ViewState["WebTab1.SelectedIndex.Old"] ?? 0);

            if (WebTab1SelectedIndexOld != WebTab1.SelectedIndex)   {

                TabChanged(WebTab1SelectedIndexOld, WebTab1.SelectedIndex);

            }

            ViewState["WebTab1.SelectedIndex.Old"] = WebTab1.SelectedIndex;

        }

        protected void TabChanged(int oldIndex, int newIndex)   {

            // Logic here....

        }

     

    I guess this is a bug in Infragistics (unless I'm not using the proper PostBackOptions), hopefully it will be fixed with the next release.

    By the way, I have found the PostBackOptions way too confusing to use it direcly from Visual Studio - I had to read the whole API documentation to understand their combination - some options won't work by them themselves. I recommend the following reading: https://help.infragistics.com/Help/Doc/ASPNET/2010.2/CLR4.0/html/Infragistics4.Web.v10.2~Infragistics.Web.UI.LayoutControls.TabPostBackOptions.html

     

    Please don't forget to mark answered if this have helped you.

     

    Thanks,

    Wagner Danda da Silva

Reply Children