Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Getting the TabIndex of an active tab for AJAX Tabs tool

Posted on 2007-11-29
6
Medium Priority
?
4,806 Views
Last Modified: 2013-11-07
Hi,

I was trying to use the AJAX tab control in my C# application. The tabes on this control should show user requests (Pending, Completed etc). Instead of building a separate gridview for each of those, I'd like to get the tabindex in the codebehind and use this value to generate the datagrid for each tab.

1. Is this the most efficient way of doing this? (I have 5 tabs in all).
2. How can I get the tabindex into the codebehind file?

Thanks for all your help!!

- Aruna
0
Comment
Question by:arunatata
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 16

Accepted Solution

by:
SQL_SERVER_DBA earned 1000 total points
ID: 20382624
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" EnableEventValidation="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<script type="text/javascript">        
    function PanelClick(sender, e) {
    }

    function ActiveTabChanged(sender, e) {
    }
</script>
<div>
    <ajaxToolkit:TabContainer runat="server" ID="Tabs" Height="150px" OnClientActiveTabChanged="ActiveTabChanged">
        <ajaxToolkit:TabPanel runat="Server" ID="Panel1" HeaderText="Tab One">
            <ContentTemplate>
                <br />PAGE ONE -  Sample HTML Content for Tab
            </ContentTemplate>
        </ajaxToolkit:TabPanel>
        <ajaxToolkit:TabPanel runat="Server" ID="Panel2" HeaderText="Tab Two" >
            <ContentTemplate>
                PAGE TWO - Sample HTML Content for Tab
            </ContentTemplate>
        </ajaxToolkit:TabPanel>
       
        <ajaxToolkit:TabPanel runat="Server" ID="Panel3" OnClientClick="PanelClick" HeaderText="Tab Three">
            <ContentTemplate>
                <BR /><BR />PAGE THREE - Sample HTML Content for Tab
            </ContentTemplate>
        </ajaxToolkit:TabPanel>
    </ajaxToolkit:TabContainer>
<br />
</div>
</form>  
</body>
</html>
0
 
LVL 16

Expert Comment

by:SQL_SERVER_DBA
ID: 20382629
heres the video that comes with the code...http://www.asp.net/learn/ajax-videos/video-156.aspx
0
 
LVL 21

Assisted Solution

by:surajguptha
surajguptha earned 1000 total points
ID: 20382813
To get the active tab you can use
Get_active tab property. How the set active tab is done is outlined in the article below. I guess u can use the get to achieve what u want....
http://news.speeple.com/msdn.com/2007/04/16/howto-change-visible-tab-using-javascript-in-the-ms-ajax-tabcontrol.htm
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20592650
Forced accept.

Computer101
EE Admin
0
 
LVL 2

Expert Comment

by:coopey247
ID: 20610231
remember to include toolkit:
using AjaxControlToolkit;

then set the active tab from the code behind like this:

TabContainer myTabContainer = (TabContainer)this.FindControl("TabContainer");
TabPanel myTabPanel2 = (TabPanel)myTabContainer.FindControl("Panel2");
myTabContainer.ActiveTab = myTabPanel2;

Where TabContainer is the id of your TabContainer and Panel2 is the id of the panel you want to highlight.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question