Solved

Getting the TabIndex of an active tab for AJAX Tabs tool

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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

752 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