Wednesday, March 28, 2012
Tab Back Color
Monday, March 26, 2012
Tab Control How to set Focus to panel
I have a datagrid on my tab control, on panel 3, When I click to put the datagrid in edit mode and the post back happens the tab control goes back to panel 1. How can I stop this or set it back to panel 3?
I tried: Did not work.
Sub NoteGrid_EditRow(ByVal SenderAs Object,ByVal eAs DataGridCommandEventArgs)
NoteGrid.EditItemIndex = e.Item.ItemIndex
BindDataNotes()
Me.TabPanel3.Focus()
End Sub
I got it,
Me.TabContainer1.ActiveTabIndex ="2"
Usethis.TabContainer.ActiveTabIndex instead ofthis.TabPanel.Focus()
Tab Navigation
Im using a gridview inside a tab(1) if i navigate to another tab(2) and then refresh on that tab(2) it takes me back to tab(1).
Anyone know how to fix this?
You need to persist the tab position in viewstate.Errrh, how do i do that? example please.
Use
Session["PAGENO"] = iPageNo;
To retrieve
if Session["PAGENO"] == null
iPageNo = 1
else
iPageNo = Session["PAGENO"]
Hi, sorry you dont have a c# version do you?
try
if (Session["PAGENO"] == null)
iPageNo = 1;
else
iPageNo = Session["PAGENO"];
does not work, I take iPageNo is a int?
The i prefix indicates that iPageNo in an integer.
Saturday, March 24, 2012
Tab Panel problem
I'm trying to programatically change tabs from within javascript without having to go back to the server. After perusing some of the source code I landed on the following simple solution below. The problem I have is that it works in IE but not Firefox and I'm at a loss as to why. I've posted my working (in IE) copy athttp://ajax.jayhawk.net but the source below is complete. (The reason I need to do this is one of my tabs displays a google map and it doesn't draw properly if the tab is not initially visible, so the page loads with the map visible, but during the onload() code it switches to thereal first tab. I saw that some else had this issue but got no responses.)
Also, while I have your attention, I've found it difficult to learn the .NET-munged name of a control on the client side. For example, I have here ID="TabContainer1" and in this trivial example it doesn't change. However, in a more complex application it might be given the name "ctl00_ContentPlaceHolder1_TabContainer1". My "solution" to the problem is to add a hidden <div> at the end that contains nothing but "<%=TabContainer1.ClientID%>" and then use a document.getElementById to fetch the actual name which I can use with $find(). There's got to be a better way to do this, doesn't there?
Thanks in advance for the feedback, and thanks for some great tools!
-bp
<%@dotnet.itags.org. Page Language="VB" AutoEventWireup="true" CodeFile="default.aspx.vb" Inherits="_Default" %>
<%@dotnet.itags.org. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!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>Tabs Test Page</title>
<script type="text/javascript">
var tab = 0;
function changetab()
{
var strContainer = document.getElementById("divTabContainer1").innerText;
var container = $find(strContainer);
container.set_activeTabIndex( ++tab > 2 ? tab = 0 : tab );
}
</script>
</head>
<body>
<form id="form1" runat="server">
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</cc1:ToolkitScriptManager>
<cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" Height="142px"
Width="269px">
<cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="TabPanel1">
<ContentTemplate>
This is tab #1
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="TabPanel2">
<ContentTemplate>
Now you're looking at tab #2
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="TabPanel3">
<ContentTemplate>
And, finally, it's tab #3!
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer><br />
<input type="button" onclick="javascript:changetab();" value="Click Me!" />
</form>
<div id="divTabContainer1" style="visibility: hidden;"><%=TabContainer1.ClientID%></div>
</body>
</html>
Hi,
I guess the reason is that innerText isn't a valid property for div element when work in Firefox. If you use a input element here, it works fine.
For instance:
var tab = 0;
function changetab()
{
var strContainer = document.getElementById("ipt").value;
var container = $find(strContainer);
container.set_activeTabIndex( ++tab > 2 ? tab = 0 : tab );
}
<input type="hidden" id="ipt" value=<%=TabContainer1.ClientID%> /
As a matter of fact, you don't need to use a element to hold its id, please try this:
</form>
<script type="text/javascript">
var tab = 0;
function changetab()
{
var container = $find("<%=TabContainer1.ClientID%>");
container.set_activeTabIndex( ++tab > 2 ? tab = 0 : tab );
}
</script>
</body>
</html>
Hope this helps.
TabContainer ActiveTab Lost
I'm using a TabContainer with 6 TabPanels. When posting back with a button, the active tab is remembered properly. However, on an autopostback from a dropdownlist, the ActiveTab does not get remembered - it does not reflect the currently selected tab (unless of course, you didn't change tabs).
Can anyone confirm this behavior? I'd love to narrow down the cause of this to make sure it's not something I'm doing. Here's the relevant markup:
<asp:dropdownlist id="ddlSubList" runat="server" Font-Size="10px" Height="20px" Visible="False" AutoPostBack="True" DataSource="<%# GetSubcontractors()%>" DataTextField="SubcontractorName" DataValueField="SubcontractorID" />I am also looking for a solution for this problem. I have not yet been able to find anything to point me in the right direction. Have you had any luck?
<ajaxToolkit:TabContainer ID="TabContainer1" runat="server" Height="600px" Width="860px" CssClass="ajax__tab_viper">
<ajaxToolkit:TabPanel ID="tabGeneralInfo" runat="server" HeaderText="General Info">
<ContentTemplate>
<pdg:GeneralInfo id="uclGeneralInfo" runat="server" style="" />
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="tabContacts" runat="server" HeaderText="Contacts">
<ContentTemplate>
<pdg:Contacts id="uclContacts" runat="server" style="" />
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="tabTrades" runat="server" HeaderText="Trades">
<ContentTemplate>
<pdg:Trades id="uclTrades" runat="server" style="" />
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="tabOpTerritory" runat="server" HeaderText="Op Territory">
<ContentTemplate>
<pdg:OpTerritory id="uclOpTerritory" runat="server" style="" />
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="tabLicenses" runat="server" HeaderText="Licenses">
<ContentTemplate>
<pdg:Licenses id="uclLicenses" runat="server" style="" />
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="tabOwnerQuals" runat="server" HeaderText="Owner Quals.">
<ContentTemplate>
<pdg:OwnerQuals id="uclOwnerQuals" runat="server" style="" />
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="tabManReps" runat="server" HeaderText="Manufacturer Rep">
<ContentTemplate>
<pdg:ManReps id="uclManReps" runat="server" style="" />
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="tabComments" runat="server" HeaderText="Comments">
<ContentTemplate>
<pdg:Comments id="uclComments" runat="server" style="" />
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="tabESProjects" runat="server" HeaderText="Subcontracts">
<ContentTemplate>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
<ContentTemplate>
<pdg:ESProjects id="uclESProjects" runat="server" style="" />
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</ajaxToolkit:TabPanel>
</ajaxToolkit:TabContainer>
No luck yet. I'm fairly sure at this point that it's a bug with the control, but I don't have time to dig into the control's source right now. Anyone else feel like doing the honors?
I'm facing the same problem.
Yep, I'm having this problem as well. It happens with any control that fires an autopostback.
Hi, I'm having a similar problem with a linkbutton within a tab. A linkbutton doesn't have an autopostback attribute so I'm guessing that the tab control only works properly with Buttons.
A simple piece of test code can be found on this post:http://forums.asp.net/thread/1578119.aspx
Andrew
The problem seems to be that the AutoPostBack behavior of DropDownList (for example) adds some JavaScript that calls __doPostBack directly and this bypasses ASP.NET AJAX's Sys.WebForms.PageRequestManager._doPostBack method which is intended to intercept submits and perform additional processing. It's this additional processing which needs to happen in order for the active tab to be maintained and the lack of it explains the problems in this thread. (Note: You can break things similarly by setting UseSubmitBehavior=false on an asp:Button that currently works.)
Curiously, ASP.NET AJAX intercepts window.__doPostBack, but not the global __doPostBack that ASP.NET adds to every page. It's seeming to me that this difference is the root of the issue here, so I'll ask some folks on the ASP.NET AJAX team to have a look when they get a chance.
After further investigation, I believe that the explanation above was based on a mistaken observation. Specifically, ASP.NET AJAX successfully intercepts __doPostBack, so that's not the problem.
What I'm thinking now is that the problem is a result of the difference between whether or not the form's onsubmit is triggered or not. For a typical Button it IS, but for an AutoPostBack (or Button with UseSubmitBehavior=false) it's NOT. Sys.WebForms.PageRequestManager._doPostBack is getting called and it's calling through to the global __doPostBack as it should. But since this is not an async postback the _doPostBack implementation is returning BEFORE calling Sys.WebForms.PageRequestManager._onFormSubmit which is where the necessary call to the form's onsubmit happens. It's in the form's onsubmit that the saveClientState method in Tabs.js gets called and saves the active tab index, so if that doesn't get called, then the active tab index doesn't get saved.
I've just openedwork item 8255 to track this problem - thanks very much for bringing it up! Watch there for updates.
PS - As a temporary workaround, it may be possible to wrap the entire TabContainer in an UpdatePanel.
Hi David,
The workaround does work (I've tried it for linkbuttons, dropdownlists and button columns in a datagrid). First workaround I've tried that also enhances the user experience
Thanks very much for looking at this.
Andrew
Thanks for the response, David! Workaround seems to work for now. I'll keep an eye on this.
A note for people like me who can not use the updater panel and are suffering from this bug. My tab container is on a user control that is loaded on a very complex control, and adding updater panels is not an option at this point. I 'hacked fixed' the situation by setting the active tab myself.
Add a hidden field to the user control or page where the tab control resides:
<asp:HiddenField ID="activeTab" runat="server" />
then add a client event for when the active tab changes:
<ajaxToolkit:TabContainer OnClientActiveTabChanged="ActiveTabChanged" runat="server" ID="tabContainer"
<script type="text/javascript"> function ActiveTabChanged(sender, e) { var activeTab = $get('<%=activeTab.ClientID%>'); activeTab.value = sender.get_activeTabIndex(); }</script>
and then add the following code to the page_load of the user control/page:
if (!string.IsNullOrEmpty(activeTab.Value)) tabContainer.ActiveTabIndex =int.Parse(activeTab.Value);
Workaround UpdatePanel works for me too.
thanks howard, hidden field method works great!
Hi folks!
I might be having the same problem, but I'm not sure that is the same issue, so I'll describe it here shortly. I want to use a TabContainer w FormViews to display different benefit configurations per products.
In an UpdatePanel, I have a tabContainer containing formviews in each tabs representing our different products and the benefit configuration for that client.
Each formview is using the sameObjectDataSource as its data source; when you click on a tab, a filter is set on the data source such as to display only the correct product information.
///
/// Those functions take care of raising the Server event upon changing the active tab.
///
1 <script type="text/javascript" language="javascript" >
2 ///
3 /// Fonction nécessaire pour attraper l'évènement c?té-client, puis le faire correspondre
4 /// à l'évènement serveur...
5 ///
6 function UserTabChanged(sender, e)
7 {
8 <%= Page.ClientScript.GetPostBackEventReference(tcConfPers, "")%>
9 }
10
11 function ConcesTabChanged(sender, e)
12 {
13 <%= Page.ClientScript.GetPostBackEventReference(tcConfConces, "")%>
14 }
/// Here is the declaration of the UpdatePanel, TabContainer, Tabs, and formviews, plus the ObjectDataSource
/// (You may disregard "SectionnableDiv " as it is only a custom panel, with an additional property...)
15 </script>
16 <asp:UpdateProgress ID="ConfPersUpdateProgress" runat="server" AssociatedUpdatePanelID="upnlConfPers" >
17 <ProgressTemplate>
18 <asp:Image ID="imgConfPersUpdateProgress" runat="server" ImageUrl="~/Dependancies/Multimedia/Images/bigrotation2.gif" />
19 </ProgressTemplate>
20 </asp:UpdateProgress>
21
22 <asp:UpdatePanel ID="upnlConfPers" runat="server" RenderMode="Inline" UpdateMode="Conditional">
23 <ContentTemplate>
24
25 <libPC:SectionnableDiv ID="divBenefPerso" AccessCode="sConfPerso" runat="server" Visible="true">
26 <libAJAX:TabContainer CssClass="ajax__tab_portal" ID="tcConfPers" runat="server" OnClientActiveTabChanged="UserTabChanged" OnActiveTabChanged="tcConfPers_OnActiveTabChanged">
27 <libAJAX:TabPanel ID="tbConfPersAWC" runat="server" HeaderText="AWChar">
28 <ContentTemplate>
29 <libPC:PortalBenefConfigView AccessCode="sConfAWC" TypeProd="AWCar" Template="~/WUC/wucBaseBenefitConfig.ascx" ID="fvBenefPersAWC" runat="server" DataSourceID="odsBenefConfigs" OnDataBound="SetRadioBtn">
30 <HeaderTemplate>
31 <asp:Label runat="server">Configuration de profits de garanties supplémentaires pour voitures</asp:Label>
32 </HeaderTemplate>
33 </libPC:PortalBenefConfigView>
34 </ContentTemplate>
35 </libAJAX:TabPanel>
36 <libAJAX:TabPanel ID="tbConfPersAWRV" runat="server" HeaderText="AWVR">
37 <ContentTemplate>
38 <libPC:PortalBenefConfigView AccessCode="sConfAWRV" TypeProd="AWRV" Template="~/WUC/wucBaseBenefitConfig.ascx" ID="fvBenefPersAWRV" runat="server" DataSourceID="odsBenefConfigs" OnDataBound="SetRadioBtn">
39 <HeaderTemplate>
40 <asp:Label runat="server">Configuration de profits de garanties supplémentaires pour véhicules récréatifs</asp:Label>
41 </HeaderTemplate>
42 </libPC:PortalBenefConfigView>
43 </ContentTemplate>
44 </libAJAX:TabPanel>
45 <libAJAX:TabPanel ID="tbConfPersAWLV" runat="server" HeaderText="AWVL">
46 <ContentTemplate>
47 <libPC:PortalBenefConfigView AccessCode="sConfAWLV" TypeProd="AWLV" Template="~/WUC/wucBaseBenefitConfig.ascx" ID="fvBenefPersAWLV" runat="server" DataSourceID="odsBenefConfigs" OnDataBound="SetRadioBtn">
48 <HeaderTemplate>
49 <asp:Label runat="server">Configuration de profits de garanties supplémentaires pour véhicules de loisir</asp:Label>
50 </HeaderTemplate>
51 </libPC:PortalBenefConfigView>
52 </ContentTemplate>
53 </libAJAX:TabPanel>
54 <libAJAX:TabPanel ID="tbConfPersRWC" runat="server" HeaderText="RWChar">
55 <ContentTemplate>
56 <libPC:PortalBenefConfigView AccessCode="sConfRWC" TypeProd="RWCar" Template="~/WUC/wucBaseBenefitConfig.ascx" ID="fvBenefPersRWC" runat="server" DataSourceID="odsBenefConfigs" OnDataBound="SetRadioBtn">
57 <HeaderTemplate>
58 <asp:Label runat="server">Configuration de profits de garanties de remplacement pour voitures</asp:Label>
59 </HeaderTemplate>
60 </libPC:PortalBenefConfigView>
61 </ContentTemplate>
62 </libAJAX:TabPanel>
63 <libAJAX:TabPanel ID="tbConfPersRWLV" runat="server" HeaderText="RWVL">
64 <ContentTemplate>
65 <libPC:PortalBenefConfigView AccessCode="sConfRWLV" TypeProd="RWLV" Template="~/WUC/wucBaseBenefitConfig.ascx" ID="fvBenefPersRWLV" runat="server" DataSourceID="odsBenefConfigs" OnDataBound="SetRadioBtn">
66 <HeaderTemplate>
67 <asp:Label runat="server">Configuration de profits de garanties de remplacement pour véhicules de loisir</asp:Label>
68 </HeaderTemplate>
69 </libPC:PortalBenefConfigView>
70 </ContentTemplate>
71 </libAJAX:TabPanel>
72 <libAJAX:TabPanel ID="tbConfPersILC" runat="server" HeaderText="AssCréd">
73 <ContentTemplate>
74 <libPC:PortalBenefConfigView AccessCode="sConfCIC" TypeProd="ILCar" Template="~/WUC/wucBaseBenefitConfig.ascx" ID="fvBenefPersCIC" runat="server" DataSourceID="odsBenefConfigs" OnDataBound="SetRadioBtn">
75 <HeaderTemplate>
76 <asp:Label runat="server">Configuration de profits d'assurance-crédit pour voitures</asp:Label>
77 </HeaderTemplate>
78 </libPC:PortalBenefConfigView>
79 </ContentTemplate>
80 </libAJAX:TabPanel>
81 </libAJAX:TabContainer>
82
83 </libPC:SectionnableDiv>
84
85 <asp:ObjectDataSource ID="odsBenefConfigs" runat="server"
86 TypeName="GroupePPP.Portal.AuthorizationDAL.CommissionInfoDAL"
87 SelectMethod="GetEntityList"
88 UpdateMethod="Save"
89 OnSelecting="odsBenefConfigs_Selecting">
90 <UpdateParameters>
91 <asp:Parameter Name="user" Type="Object" />
92 <asp:Parameter Name="da" Type="Object" />
93 </UpdateParameters>
94 <SelectParameters>
95 <asp:Parameter Name="IDConces" Type="Int32" />
96 <asp:Parameter Name="IDUser" Type="Int32" />
97 <asp:Parameter Name="da" Type="Object" />
98 </SelectParameters>
99 </asp:ObjectDataSource>
100
101 </ContentTemplate>
102 </asp:UpdatePanel>
Problem is: When I first change the active tab, the page is doing a full post-back, instead of a partial one, and there is no change of tabs, or filter applied on the ods, but on all subsequent changes of tab, only a partial postback is made(which is good.)
On every change(after the first one), the filter is set appropriately (the contained ObjectDataSource is filtered and the formview displays the correct product information.) But when I go to edit mode (in any one of the formviews), the partial post-back is made, but the ODS seems to lose its state (I'm now in the correct tab, but the filter went away, and the data displayed is the first record in the underlying datatable.) If I then go to another tab and come back to the one I wanted to edit, the other is in read-only mode, and the one I asked for is still in edit mode, on the correct record.
I might have given too many details, but as I'm new to AJAX, I tried to include all relevant information... Please do not hesitate to ask for clarifications.
Thank you all for your time!
Hi folks!
I might be having the same problem, but I'm not sure that is the same issue, so I'll describe it here shortly. I want to use a TabContainer w FormViews to display different benefit configurations per products.
In an UpdatePanel, I have a tabContainer containing formviews in each tabs representing our different products and the benefit configuration for that client.
Each formview is using the sameObjectDataSource as its data source; when you click on a tab, a filter is set on the data source such as to display only the correct product information.
///
/// Those functions take care of raising the Server event upon changing the active tab.
///
1 <script type="text/javascript" language="javascript" >
2 ///
3 /// Fonction nécessaire pour attraper l'évènement c?té-client, puis le faire correspondre
4 /// à l'évènement serveur...
5 ///
6 function UserTabChanged(sender, e)
7 {
8 <%= Page.ClientScript.GetPostBackEventReference(tcConfPers, "")%>
9 }
10
11 function ConcesTabChanged(sender, e)
12 {
13 <%= Page.ClientScript.GetPostBackEventReference(tcConfConces, "")%>
14 }
/// Here is the declaration of the UpdatePanel, TabContainer, Tabs, and formviews, plus the ObjectDataSource
/// (You may disregard "SectionnableDiv " as it is only a custom panel, with an additional property...)
15 </script>
16 <asp:UpdateProgress ID="ConfPersUpdateProgress" runat="server" AssociatedUpdatePanelID="upnlConfPers" >
17 <ProgressTemplate>
18 <asp:Image ID="imgConfPersUpdateProgress" runat="server" ImageUrl="~/Dependancies/Multimedia/Images/bigrotation2.gif" />
19 </ProgressTemplate>
20 </asp:UpdateProgress>
21
22 <asp:UpdatePanel ID="upnlConfPers" runat="server" RenderMode="Inline" UpdateMode="Conditional">
23 <ContentTemplate>
24
25 <libPC:SectionnableDiv ID="divBenefPerso" AccessCode="sConfPerso" runat="server" Visible="true">
26 <libAJAX:TabContainer CssClass="ajax__tab_portal" ID="tcConfPers" runat="server" OnClientActiveTabChanged="UserTabChanged" OnActiveTabChanged="tcConfPers_OnActiveTabChanged">
27 <libAJAX:TabPanel ID="tbConfPersAWC" runat="server" HeaderText="AWChar">
28 <ContentTemplate>
29 <libPC:PortalBenefConfigView AccessCode="sConfAWC" TypeProd="AWCar" Template="~/WUC/wucBaseBenefitConfig.ascx" ID="fvBenefPersAWC" runat="server" DataSourceID="odsBenefConfigs" OnDataBound="SetRadioBtn">
30 <HeaderTemplate>
31 <asp:Label runat="server">Configuration de profits de garanties supplémentaires pour voitures</asp:Label>
32 </HeaderTemplate>
33 </libPC:PortalBenefConfigView>
34 </ContentTemplate>
35 </libAJAX:TabPanel>
36 <libAJAX:TabPanel ID="tbConfPersAWRV" runat="server" HeaderText="AWVR">
37 <ContentTemplate>
38 <libPC:PortalBenefConfigView AccessCode="sConfAWRV" TypeProd="AWRV" Template="~/WUC/wucBaseBenefitConfig.ascx" ID="fvBenefPersAWRV" runat="server" DataSourceID="odsBenefConfigs" OnDataBound="SetRadioBtn">
39 <HeaderTemplate>
40 <asp:Label runat="server">Configuration de profits de garanties supplémentaires pour véhicules récréatifs</asp:Label>
41 </HeaderTemplate>
42 </libPC:PortalBenefConfigView>
43 </ContentTemplate>
44 </libAJAX:TabPanel>
45 <libAJAX:TabPanel ID="tbConfPersAWLV" runat="server" HeaderText="AWVL">
46 <ContentTemplate>
47 <libPC:PortalBenefConfigView AccessCode="sConfAWLV" TypeProd="AWLV" Template="~/WUC/wucBaseBenefitConfig.ascx" ID="fvBenefPersAWLV" runat="server" DataSourceID="odsBenefConfigs" OnDataBound="SetRadioBtn">
48 <HeaderTemplate>
49 <asp:Label runat="server">Configuration de profits de garanties supplémentaires pour véhicules de loisir</asp:Label>
50 </HeaderTemplate>
51 </libPC:PortalBenefConfigView>
52 </ContentTemplate>
53 </libAJAX:TabPanel>
54 <libAJAX:TabPanel ID="tbConfPersRWC" runat="server" HeaderText="RWChar">
55 <ContentTemplate>
56 <libPC:PortalBenefConfigView AccessCode="sConfRWC" TypeProd="RWCar" Template="~/WUC/wucBaseBenefitConfig.ascx" ID="fvBenefPersRWC" runat="server" DataSourceID="odsBenefConfigs" OnDataBound="SetRadioBtn">
57 <HeaderTemplate>
58 <asp:Label runat="server">Configuration de profits de garanties de remplacement pour voitures</asp:Label>
59 </HeaderTemplate>
60 </libPC:PortalBenefConfigView>
61 </ContentTemplate>
62 </libAJAX:TabPanel>
63 <libAJAX:TabPanel ID="tbConfPersRWLV" runat="server" HeaderText="RWVL">
64 <ContentTemplate>
65 <libPC:PortalBenefConfigView AccessCode="sConfRWLV" TypeProd="RWLV" Template="~/WUC/wucBaseBenefitConfig.ascx" ID="fvBenefPersRWLV" runat="server" DataSourceID="odsBenefConfigs" OnDataBound="SetRadioBtn">
66 <HeaderTemplate>
67 <asp:Label runat="server">Configuration de profits de garanties de remplacement pour véhicules de loisir</asp:Label>
68 </HeaderTemplate>
69 </libPC:PortalBenefConfigView>
70 </ContentTemplate>
71 </libAJAX:TabPanel>
72 <libAJAX:TabPanel ID="tbConfPersILC" runat="server" HeaderText="AssCréd">
73 <ContentTemplate>
74 <libPC:PortalBenefConfigView AccessCode="sConfCIC" TypeProd="ILCar" Template="~/WUC/wucBaseBenefitConfig.ascx" ID="fvBenefPersCIC" runat="server" DataSourceID="odsBenefConfigs" OnDataBound="SetRadioBtn">
75 <HeaderTemplate>
76 <asp:Label runat="server">Configuration de profits d'assurance-crédit pour voitures</asp:Label>
77 </HeaderTemplate>
78 </libPC:PortalBenefConfigView>
79 </ContentTemplate>
80 </libAJAX:TabPanel>
81 </libAJAX:TabContainer>
82
83 </libPC:SectionnableDiv>
84
85 <asp:ObjectDataSource ID="odsBenefConfigs" runat="server"
86 TypeName="GroupePPP.Portal.AuthorizationDAL.CommissionInfoDAL"
87 SelectMethod="GetEntityList"
88 UpdateMethod="Save"
89 OnSelecting="odsBenefConfigs_Selecting">
90 <UpdateParameters>
91 <asp:Parameter Name="user" Type="Object" />
92 <asp:Parameter Name="da" Type="Object" />
93 </UpdateParameters>
94 <SelectParameters>
95 <asp:Parameter Name="IDConces" Type="Int32" />
96 <asp:Parameter Name="IDUser" Type="Int32" />
97 <asp:Parameter Name="da" Type="Object" />
98 </SelectParameters>
99 </asp:ObjectDataSource>
100
101 </ContentTemplate>
102 </asp:UpdatePanel>
Problem is: When I first change the active tab, the page is doing a full post-back, instead of a partial one, and there is no change of tabs, or filter applied on the ods, but on all subsequent changes of tab, only a partial postback is made(which is good.)
On every change(after the first one), the filter is set appropriately (the contained ObjectDataSource is filtered and the formview displays the correct product information.) But when I go to edit mode (in any one of the formviews), the partial post-back is made, but the ODS seems to lose its state (I'm now in the correct tab, but the filter went away, and the data displayed is the first record in the underlying datatable.) If I then go to another tab and come back to the one I wanted to edit, the other is in read-only mode, and the one I asked for is still in edit mode, on the correct record.
I might have given too many details, but as I'm new to AJAX, I tried to include all relevant information... Please do not hesitate to ask for clarifications.
Thank you all for your time!
P.S.: Sorry for the double-post; the forum parser had a hard-time wih the accentuated "e", in "Quebec"... ;)
Wednesday, March 21, 2012
TabContainer is get back to the first tab each page load
who to fix it?
<ajaxToolkit:TabContainer ID="TabContainer1" runat="server" Height="150px" ActiveTabIndex="0"> <ajaxToolkit:TabPanel ID="TabPanel1" runat="server" HeaderText="???? ????" > <ContentTemplate> <uc1:Clientdetails ID="Clientdetails1" runat="server" /> </ContentTemplate> </ajaxToolkit:TabPanel> <ajaxToolkit:TabPanel ID="TabPanel2" runat="server" HeaderText="?????"> <ContentTemplate> <uc2:CommentsList ID="CommentsList1" runat="server" /> </ContentTemplate> </ajaxToolkit:TabPanel> <ajaxToolkit:TabPanel ID="TabPanel3" runat="server" HeaderText="??????"> <ContentTemplate> <uc3:ClientsOrder ID="ClientsOrder1" runat="server" /> </ContentTemplate> </ajaxToolkit:TabPanel> </ajaxToolkit:TabContainer>
is there other easy way to do it except using session
is there other easy way to do it except using session>?
well i am kinda new to this myself. But i think removing the ActiveTabIndex="0" property might help, since every page refresh it reads that property again and set the active tab to 0. Thus your first tab.
Hi Roy,
I'm afraid the information you provided isn't sufficient enough to solve it.
I copied your code into my page, but can't reproduce it.
<%@. Page Language="C#" %><!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 id="Head1" runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <ajaxToolkit:TabContainer ID="TabContainer1" runat="server" Height="150px" ActiveTabIndex="0"> <ajaxToolkit:TabPanel ID="TabPanel1" runat="server" HeaderText="???? ????" > <ContentTemplate> <asp:Button ID="Button1" runat="server" Text="Button" /> </ContentTemplate> </ajaxToolkit:TabPanel> <ajaxToolkit:TabPanel ID="TabPanel2" runat="server" HeaderText="?????"> <ContentTemplate> <asp:Button ID="Button2" runat="server" Text="Button" /> </ContentTemplate> </ajaxToolkit:TabPanel> <ajaxToolkit:TabPanel ID="TabPanel3" runat="server" HeaderText="??????"> <ContentTemplate> <asp:Button ID="Button3" runat="server" Text="Button" /> </ContentTemplate> </ajaxToolkit:TabPanel> </ajaxToolkit:TabContainer> </form></body></html>
TabContainer inside UpdatePanel
I went through the forum to about 15 pages back and saw this issue come up in some way or another quite a few times but never fully resolved.
Basically I have the following:
<asp:UpdatePanel ChildrenAsTriggers="true" runat="server" ID="dataEdit" UpdateMode="Always">
<ContentTemplate>
<ajaxToolkit:TabContainer ID="tabEdit" runat="server" Visible="false">
<ajaxToolkit:TabPanel runat="server" HeaderText="tab one">
<ContentTemplate> <!-- some standard controls --> </ContentTemplate>
</ajaxToolkit:TabPanel>
</ajaxToolkit:TabContainer>
</ContentTemplate>
</asp:UpdatePanel>
Note that the TabContainer starts out with Visible="false". The idea is that this section is invisible until the user selects from a list, at which point the tabs become visible and the list becomes Enabled="false". Without the UpdatePanel encapsulating the TabContainer, everything works as desired (except for the full page refresh of course). But with the UpdatePanel, the TabContainer (while still functioning) is rendered with no styles. It appears in plain-text as:
Tab OneTab TwoTab Three
< contents >
With no borders and seemingly no way to restyle it. It is rendered correctly if the TabContainer starts out with Visible="true".
Any help would be appreciated. Thanks.
Hi,
Please note that if a server control's visible is set to false, this control won't be rendered to the output.
Subsequently, the TabContainer's initialization which is supposed to execute when the page is initially loaded isn't performed.
The work around is hide this control with javascript. For instance:
function pageLoad() { // this method is called automatically when the page is loaded on client side according to the life cycleof ajax script library
tc2 = $get("TabContainer1");
tc2.style.visibility="hidden"; // hide it with javascript
}
Hope this helps.
Does anybody have another solution to this? Because having the control rendered is not an option to me.
Hello,
Did you find a solution to this? I am having the same problem and would like to see what you have implemented.
Thanks
Add an empty (Without TABs) TabContainer somewhere on the page (but keep it Visible). It will not render any visible content to the page, but make CSS to be loaded from the beginning.
-yuriy