title: Tabs resetting after selecting drop down list in C# , ASP.net
body: <pre><code>&lt;ul id="tabs"&gt;
    &lt;li&gt;&lt;a href="#" name="#tab1"&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#" name="#tab2"&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#" name="#tab3"&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#" name="#tab4"&gt;&lt;/a&gt;&lt;/li&gt; 
    &lt;li&gt;&lt;a href="#" name="#tab5"&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#" name="#tab6"&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#" name="#tab7"&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#" name="#tab8"&gt;&lt;/a&gt;&lt;/li&gt;      
  </code></pre>
  
  <p></p>
  
  <p>
         </p>
  
  <pre><code>  &lt;/div&gt;
    &lt;div id="tab2"&gt;
  
    &lt;/div&gt;
    &lt;div id="tab3"&gt;
  
  
    &lt;/div&gt;
    &lt;div id="tab4"&gt;
  
    &lt;/div&gt;
    &lt;div id="tab5"&gt;
  
    &lt;/div&gt;
    &lt;div id="tab6"&gt;
     &lt;table&gt;
            &lt;tr&gt;
                &lt;td style ="color: Black "&gt;&lt;asp:DropDownList ID="ddlPageSize1" runat="server" AutoPostBack="True"  onselectedindexchanged="ddlPageSize_SelectedIndexChanged1"&gt;
                    &lt;asp:ListItem&gt;10&lt;/asp:ListItem&gt;
                    &lt;asp:ListItem&gt;25&lt;/asp:ListItem&gt;
                    &lt;asp:ListItem&gt;50&lt;/asp:ListItem&gt;
                    &lt;asp:ListItem&gt;100&lt;/asp:ListItem&gt;
                    &lt;asp:ListItem&gt;250&lt;/asp:ListItem&gt;
                    &lt;/asp:DropDownList&gt;&lt;/td&gt;
  
            &lt;/tr&gt;
            &lt;tr&gt;
               &lt;td colspan="6"&gt;
        &lt;asp:GridView ID="GridView2" runat="server" AllowPaging="True" AllowSorting="True" CurrentSortField="ActivityDate" CurrentSortDirection="ASC" CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt" AutoGenerateColumns="False" OnPreRender="GridView2_PreRender" OnSorting="GridView2_Sorting" BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" CellPadding="3" ForeColor="Black" GridLines="Vertical" OnRowCommand="GridView2_RowCommand" OnRowCreated="GridView2_RowCreated" &gt;
            &lt;AlternatingRowStyle BackColor="#CCCCCC" /&gt;
            &lt;Columns&gt;
                &lt;asp:BoundField DataField="username" HeaderText="username" SortExpression="username" /&gt;
                &lt;asp:BoundField DataField="ActivityDate" HeaderText="ActivityDate" SortExpression="ActivityDate" /&gt;
                &lt;asp:BoundField DataField="Action" HeaderText="Action" SortExpression="Action" /&gt;
                &lt;asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" /&gt;
                &lt;asp:BoundField DataField="Outcome" HeaderText="Outcome" SortExpression="Outcome" /&gt;
                &lt;asp:TemplateField HeaderText="File" ShowHeader="False"&gt; &lt;ItemTemplate&gt;
              &lt;asp:LinkButton ID="LinkButton1" runat="server" 
                  CausesValidation="False" 
                  CommandArgument='&lt;%# Eval("ImportedFilename") %&gt;'
                  CommandName="Download" Text='&lt;%# Eval("ImportedFilename") %&gt;'&gt;
                  &lt;/asp:LinkButton&gt;
          &lt;/ItemTemplate&gt;
       &lt;/asp:TemplateField&gt;
            &lt;/Columns&gt;
            &lt;FooterStyle BackColor="#CCCCCC" /&gt;
            &lt;HeaderStyle BackColor="#999999" Font-Bold="True" ForeColor="Black" BorderStyle="Dashed" BorderWidth="1" BorderColor="Black" Font-Size="Medium" Font-Names="Arial" /&gt;
            &lt;PagerStyle  ForeColor="#330099" HorizontalAlign="Center" BorderStyle="None" /&gt;
            &lt;RowStyle BackColor="White" BorderStyle="Solid" BorderWidth="1" BorderColor="Black" Font-Size="Medium" HorizontalAlign="Center" ForeColor="Black"/&gt;
            &lt;SortedAscendingCellStyle BackColor="#F1F1F1" /&gt;
            &lt;SortedAscendingHeaderStyle BackColor="#808080" /&gt;
            &lt;SortedDescendingCellStyle BackColor="#CAC9C9" /&gt;
            &lt;SortedDescendingHeaderStyle BackColor="#383838" /&gt;
        &lt;/asp:GridView&gt;
  
         &lt;/td&gt;          
          &lt;/tr&gt;
            &lt;tr&gt;
            &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/td&gt;
            &lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;asp:Label ID="Label5" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
            &lt;td style ="color: Black "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Page Number:&lt;asp:DropDownList ID="ddlPageNumbers1" runat="server" AutoPostBack="True" onselectedindexchanged="ddlPageNumbers_SelectedIndexChanged1"&gt;&lt;/asp:DropDownList&gt;&lt;/td&gt;          
             &lt;/tr&gt;
        &lt;/table&gt;
        &lt;asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="GetAllImportLogs" TypeName="demo.ImportLogAccessLayer"&gt;
            &lt;SelectParameters&gt;
                &lt;asp:Parameter Name="pageIndex" Type="Int32" /&gt;
                &lt;asp:Parameter Name="pageSize" Type="Int32" /&gt;
                &lt;asp:Parameter Name="sortExpression" Type="String" /&gt;
                &lt;asp:Parameter Name="sortDirection" Type="String" /&gt;
                &lt;asp:Parameter Direction="Output" Name="totalRows" Type="Int32" /&gt;
            &lt;/SelectParameters&gt;
        &lt;/asp:ObjectDataSource&gt;
  
    &lt;/div&gt;
    &lt;div id="tab7"&gt;
  
    &lt;/div&gt;
    &lt;div id="tab8"&gt;
     &lt;/div&gt;   
  </code></pre>
  
  <p></p>
  
  <p></p>
  
  <p></p>
  
  <pre><code>  function resetTabs() {
        $("#content &gt; div").hide(); //Hide all content
        $("#tabs a").attr("id", ""); //Reset id's     
  
    }
  
    var myUrl = window.location.href; //get URL
    var myUrlTab = myUrl.substring(myUrl.indexOf("#")); // For localhost/tabs.html#tab2, myUrlTab = #tab2     
    var myUrlTabName = myUrlTab.substring(0, 4); // For the above example, myUrlTabName = #tab
  
  
  Sys.Application.add_Load(tabs);
        (function tabs() {
        $("#content &gt; div").hide(); // Initially hide all content
        $("#tabs li:first a").attr("id", "current"); // Activate first tab
        $("#content &gt; div:first").fadeIn(); // Show first tab content
  
        $("#tabs a").on("click", function (e) {
            e.preventDefault();
            if ($(this).attr("id") == "current") { //detection for current tab
                return
            }
            else {
                resetTabs();
                $(this).attr("id", "current"); // Activate this
                $($(this).attr('name')).fadeIn(); // Show content for current tab
            }
        });
  
        for (i = 1; i &lt;= $("#tabs li").length; i++) {
            if (myUrlTab == myUrlTabName + i) {
                resetTabs();
                $("a[name='" + myUrlTab + "']").attr("id", "current"); // Activate url tab
                $(myUrlTab).fadeIn(); // Show url tab content        
            }
        }
    })()
  </code></pre>
  
  <p></p>
  
  <p>When ever I try to use dropdown in tab 6, It resets to tab 1. The dropdown list works fine, but i have to again click tab 6 to look at the result. I tried to fix it several ways, it did not work. Any help would be appreciated to prevent the tabs from getting resetting.</p>