Solved

Getting the TabIndex of an active tab for AJAX Tabs tool

Posted on 2007-11-29
6
4,785 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 250 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 250 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now