Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6164551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:00:47+00:00 2026-05-23T22:00:47+00:00

I have a few tabs on a page and it always defaults to the

  • 0

I have a few tabs on a page and it always defaults to the first tab , but when a link is clicked i want it to select a diferent tab using javascript. How can I select the tab with Javascript?

Right now, because the default is selecting the first tab, javascript throws an error that either pnlTab2 is not visible or does not exist. But if I manually click on the tab and then on the link it focuses on that tab correctly?

I am new in C# and Javascript, can anyone please help me?, how can I select the second tab using javascript and then focus so that it does not give me error?

Thank you

 function DoFocus() {
    var pnlTab1 = document.getElementById('<%=pnlTab1.ClientID%>');
    var pnlTab2 = document.getElementById('<%=pnlTab2.ClientID%>');

    if (pnlTab2 != null ) {

        //I WANT TO SELECT THE TAB HERE
        document.getElementById('<%=pnlCustomerReviews.ClientID%>').focus();
    }
    else {
         //OR SELECT THIS ONE
        document.getElementById('<%=pnlTab2.ClientID%>').focus();
    }
         return false;
}

<asp:UpdatePanel ID="UpdatePnl" runat="server" UpdateMode="Conditional">
        <ContentTemplate>     
            <ajaxToolKit:TabContainer runat="server" id="myTabs" CssClass="CustomTabStyle">
            <ajaxToolKit:TabPanel ID="pnlTab1" runat="server" HeaderText="Tab 1">                                                  
            <ContentTemplate> 
                <table> 
                    <tr>                           
                        <td>                 
                            <div class="Tab1">                     
                                <asp:Label ID="lblPnl1" runat="server"></asp:Label>                                                   
                            </div>                              
                        </td>
                    </tr>   
                </table> 
            </ContentTemplate>             
            </ajaxToolKit:TabPanel>

            <ajaxToolKit:TabPanel ID="pnlTab2" runat="server" HeaderText="Tab2">               
            <ContentTemplate>              
                <table>
                    <tr>
                        <td>
                            <div class="Tab2">                     
                                <asp:Label ID="lblPnl2" runat="server"></asp:Label>                       
                            </div>
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
           </ajaxToolKit:TabPanel>
 </ajaxToolKit:TabContainer>
    </ContentTemplate>
</asp:UpdatePanel>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:00:48+00:00Added an answer on May 23, 2026 at 10:00 pm

    Try this: http://forums.asp.net/t/1127834.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have few tabs with input on each tab. I am using and I
I have a web page with few tabs. All tabs have same data but
I have a page with 3 tabs on it. The first tab has a
I have few tabs like Photo,Story,Graphics inside XamDockManager.I need to select a tab on
I have an SherlockFragmentActivity that is showing a few tabs. Each tab is ListFragment.
I got this an asp.net 3.5 page that and I have few tabs (telerik
I have a page with few tabs. I am looking for a way that
I have a .NET forms application using a tab control with several tabs. There
So I have a few tabs in the form, and i want it to
Currently, I have a TabLayoutPanel with a few tabs, inside of each tab is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.