Hi
I am using ajax tab panel. The problem is, I am unable to capture any event when I toggle between tabs. Actually I am generating the tab panel dynamically, now I want to change the color of a help menu when the user toggles between the tabs. For this to happen I need some kind of event but could not get it.
I tried using "onclientclick" but that was not helpful.A
Help needed
Regards
Abhishek
Take a look here: http://asp.net/AJAX/Control-Toolkit/Live/Tabs/Tabs.aspx
Either theOnClientActiveTabChanged orActiveTabChanged event should be what you're after.
Thanks you very much for solving my problem
My master page is
<%@.MasterLanguage="C#"AutoEventWireup="true"CodeBehind="Site1.master.cs"Inherits="TabSample.Site1" %><%@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>Untitled Page</title></head>
<body>
<formid="form1"runat="server">
<div>
<asp:ContentPlaceHolderID="ContentPlaceHolder1"runat="server">
</asp:ContentPlaceHolder>
<tablerunat="server"id="tbtest">
<trrunat="server"id="trtest">
<tdrunat="server"id="tdtest"><asp:labelid="spn"runat="server">HELLO</asp:label>
</td>
</tr>
</table>
</div>
</form></body>
</html>
My content page.aspx is:
<%@.PageLanguage="C#"MasterPageFile="~/Site1.Master"AutoEventWireup="true"CodeBehind="Default.aspx.cs"Inherits="TabSample._Default" %><%@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>
<asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"runat="server">
<scripttype="text/javascript"language="javascript">
function ActiveTabChanged(sender, e){ __doPostBack('<%= tabs2.ClientID %>',sender.get_activeTab().get_headerText());
}
</script>
<asp:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="true">
</asp:ScriptManager>
<asp:UpdatePanelID="OuterUpdatePanel"runat="server"UpdateMode="Conditional">
<ContentTemplate><cc1:TabContainerrunat="server"ID="tabs2"Height="150px"OnClientActiveTabChanged="ActiveTabChanged"OnActiveTabChanged="DoServerSideValidation">
<cc1:TabPanelrunat="Server"ID="TabPanel0"HeaderText="Tab One">
<ContentTemplate>This is panel 1
</ContentTemplate></cc1:TabPanel>
<cc1:TabPanelrunat="Server"ID="TabPanel1"HeaderText="Tab Two"><ContentTemplate>
This is panel 2
</ContentTemplate></cc1:TabPanel>
</cc1:TabContainer>
</ContentTemplate><Triggers>
<asp:AsyncPostBackTriggerControlID="tabs2"EventName="ActiveTabChanged"/></Triggers></asp:UpdatePanel>
</asp:Content>
My content page.cs is:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using AjaxControlToolkit;
namespace TabSample{
publicpartialclass_Default : System.Web.UI.Page
{
#region designer controlprotectedScriptManager ScriptManager1;
protectedTabContainer tabs2;protected System.Web.UI.HtmlControls.HtmlTable tbtest;
protected System.Web.UI.HtmlControls.HtmlTableCell tdtest;
#endregion
protectedvoid Page_Load(object sender,EventArgs e){
ScriptManager1.RegisterAsyncPostBackControl(tabs2);
}
protectedvoid DoServerSideValidation(object sender,EventArgs e){
TabContainer tc;tc = (TabContainer)sender;
string str;
if (tc.ActiveTabIndex == 0){
str ="#99ccff";}
else
{
str ="#505050";}
HtmlTableCell _tdtest;_tdtest = (HtmlTableCell)Master.FindControl("tdtest");
string str1 = _tdtest.InnerText.ToString();string str2 = _tdtest.InnerHtml.ToString();
_tdtest.Attributes.Add("bgcolor", str);_tdtest.Style.Add("background-color", str);
_tdtest.InnerText ="TESTESTS";_tdtest.Visible =false;
}
}
}
The problem is although the server side event "DoServerSideValidation" fires and executes the desired change is not reflected in the master page.
Help sought.
Thanks.
No comments:
Post a Comment