Solved

Getting the TabIndex of an active tab for AJAX Tabs tool

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

622 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