Skip to content

Infragistics Community Forum / Web / Ultimate UI for ASP.NET Web Forms / SelectedIndexChanged Not Firing After First Click

SelectedIndexChanged Not Firing After First Click

New Discussion
Rob
Rob asked on Aug 11, 2010 5:40 PM

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?

Sign In to post a reply

Replies

  • 0
    Wagner
    Wagner answered on Aug 10, 2010 5:18 PM

    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

    • 0
      Wagner
      Wagner answered on Aug 10, 2010 7:37 PM

      Actually, I have found out a simpler workaround… Just add a UpdatePanel around the WebTab control… Once you do that then the event will be fired for the first tab click.

      Cheers,

      Wagner Danda da Silva

      • 0
        Rob
        Rob answered on Aug 11, 2010 3:55 PM

        Already have the webtab control in an update panel.  Trying to get it to fire on every tab change, not just the first click.

      • 0
        Wagner
        Wagner answered on Aug 11, 2010 4:18 PM

        Can you show us a snippet of your code so we can help you better?

      • 0
        Rob
        Rob answered on Aug 11, 2010 5:15 PM

          <asp:ScriptManager ID="ScriptManager1" runat="server">
          </asp:ScriptManager>
          <asp:UpdatePanel ID="UpdatePanel1" runat="server">
           <ContentTemplate>
            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
            <ig:WebTab ID="WebTab1" runat="server" Height="184px" Width="700px" StyleSetName="Default"
             EnableOverlappingTabs="true">
             <Tabs>
              <ig:ContentTabItem runat="server" Text="tab 1">
              </ig:ContentTabItem>
              <ig:ContentTabItem runat="server" Text="tab 2">
              </ig:ContentTabItem>
              <ig:ContentTabItem runat="server" Text="tab 3">
              </ig:ContentTabItem>
             </Tabs>
             <PostBackOptions EnableAjax="true" EnableLoadOnDemand="true" />
            </ig:WebTab>
           </ContentTemplate>
          </asp:UpdatePanel>

         Protected Sub WebTab1_SelectedIndexChanged(ByVal sender As Object, ByVal e As Infragistics.Web.UI.LayoutControls.TabSelectedIndexChangedEventArgs) Handles WebTab1.SelectedIndexChanged
          Label1.Text = Now.ToLongTimeString
         End Sub

        The SelectedIndexChanged event only first for the first click on each tab, have tried a number of combinations with PostBackOptions with no luck.

      • 0
        Wagner
        Wagner answered on Aug 11, 2010 5:40 PM

        You don't have the right PostBackOptions…. Try this instead:

        <PostBackOptions 

        EnableReloadingUnselectedTab="true

        EnableAjax="true" EnableLoadOnDemand="false" />


  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Rob
Favorites
0
Replies
6
Created On
Aug 11, 2010
Last Post
15 years, 6 months ago

Suggested Discussions

Created by

Rob

Created on

Aug 11, 2010 5:40 PM

Last activity on

Feb 11, 2026 6:22 PM