Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Getting the TabIndex of an active tab for AJAX Tabs tool

Posted on 2007-11-29
6
Medium Priority
?
4,810 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
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Integration Management Part 2

972 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