ASPX templates
Version 6.x > ASPX templates > cms:BasicTabControl seems to ignore UsePostback="true" property View modes: 
User avatar
Certified Developer v6
Certified Developer v6
Nortech - 7/13/2012 5:50:43 AM
   
cms:BasicTabControl seems to ignore UsePostback="true" property
I supposed that setting UsePostback="true" on cms:BasicTabControl would trigger postpacks instead of links on the tabs.

I noticed this on MyAccount web part when I needed to use an update panel so that clicking on a tab would not refresh the whole page.


User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 7/23/2012 5:12:50 AM
   
RE:cms:BasicTabControl seems to ignore UsePostback="true" property
Hello,

I am not sure whether I understand it. You use UsePostback="true" and update panel, right? How should it behave according to you? When you click on a tab, it should fire a postback inside the update panel (not the whole page)? How does it work now? Thank you in advance for more details.


Best regards,
Helena Grulichova


User avatar
Certified Developer v6
Certified Developer v6
Nortech - 7/23/2012 5:50:30 AM
   
RE:cms:BasicTabControl seems to ignore UsePostback="true" property
When clicking a tab it should fire a postback, but instead it renders a link (with a querystring) that when clicked causes the whole page to refresh.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 7/23/2012 8:23:05 AM
   
RE:cms:BasicTabControl seems to ignore UsePostback="true" property
Hello,


what link do you use for that tab? On the same page?

Can you show the code which you use (with the update panel as well) from the ASPX template and code behind? Especially, the settings of tabs.

I am trying to reproduce the issue. If I add UsePostback="true", it fires a full post back on the original page. If I add an update panel like:

<cms:CMSUpdatePanel runat="server" ID="updatePanel1">
<ContentTemplate>
<cms:BasicTabControl ID="BasicTabControl1" runat="server" UsePostback="true" />
</ContentTemplate>
</cms:CMSUpdatePanel>

Code behind:

 protected void Page_Load(object sender, EventArgs e)
{
string[,] tabs = new string[3, 7];



tabs[0, 0] = " Home ";

tabs[0, 1] = "alert('It is very simple!');";

tabs[0, 2] = "http://localhost/6/home.aspx";

tabs[1, 0] = " Features ";

tabs[1, 2] = "http://www.kentico.com/free-cms-asp-net.aspx";

tabs[2, 0] = " Download ";

tabs[2, 2] = "http://www.kentico.com/download/trial-version.aspx";

tabs[2, 3] = "Some tooltip";



BasicTabControl1.Tabs = tabs;

BasicTabControl1.SelectedTab = 0;

BasicTabControl1.UrlTarget = "_blank";

BasicTabControl1.UseClientScript = true;

if (IsPostBack) {
BasicTabControl1.RenderedHTML = "test!";
}
}

It causes a partial postback correctly on the original page and opens the selected tab link on a new window.


Best regards,
Helena Grulichova

User avatar
Certified Developer v6
Certified Developer v6
Nortech - 7/24/2012 2:07:14 AM
   
RE:cms:BasicTabControl seems to ignore UsePostback="true" property
Thank you for your help.

The original problem has been to make MyAccount web part to use an update panel. The problem seems to appear there. If you modify MyAccount.ascx and add UsePostback="true" on cms:BasicTabControl ID="tabMenu" it should fire postback calls when clicking the tabs. At the same time I added the property UseUpdatePanel="true" on the page tamplate that uses the MyAccount webpart.

On the aspx page template:

<cms:MyAccount ID="MyAccount2" runat="server" UseUpdatePanel="true"
DisplayMyOrders="false" DisplayMySubscriptions="false" DisplayMyFriends="false" DisplayMyNotifications="false" DisplayMyMessages="false" />


Did you try it on MyAccount Web part?
On MyAccount.ascx web part:

<%@ Control Language="C#" AutoEventWireup="true" Inherits="CMSWebParts_Membership_Profile_MyAccount"
CodeFile="~/CMSWebParts/Membership/Profile/MyAccount.ascx.cs" %>
<%@ Register Src="~/CMSModules/Membership/FormControls/Passwords/ChangePassword.ascx" TagName="ChangePassword"
TagPrefix="cms" %>
<%@ Register Src="~/CMSModules/Membership/Controls/MyProfile.ascx" TagName="MyProfile"
TagPrefix="cms" %>
<asp:Panel runat="server" ID="pnlBody" CssClass="MyAccount">
<div class="TabsHeader">
<cms:BasicTabControl ID="tabMenu" runat="server" UsePostback="true" />
</div>
<asp:Panel ID="pnlTabs" runat="server" CssClass="TabsContent">
<asp:Label ID="lblError" CssClass="ErrorLabel" runat="server" Visible="false" EnableViewState="false" />
<cms:MyProfile ID="myProfile" runat="server" Visible="false" StopProcessing="true" />
<cms:ChangePassword ID="ucChangePassword" runat="server" Visible="false" />
<asp:PlaceHolder runat="server" ID="plcOther" />
</asp:Panel>
</asp:Panel>



Did you try it on MyAccount web part?


User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 7/25/2012 5:04:38 AM
   
RE:cms:BasicTabControl seems to ignore UsePostback="true" property
Hello,


My account uses links to itself so that it reloads the full page. Even if there is a partial postback, the link causes a redirection - to itself. It is not possible to use BasicTabControl with the partial postback in the way you need. It would be needful to develop a new control similar to My account but with different enveloping instead of BasicTabControl. You can use for example AJAX tabs or any control which will generate the buttons for particular "tabs", cause a postback when a user clicks on them and load the controls for particular tabs. Then you can envelop the new My account control by the update panel and the partial postback will work.


Best regards,
Helena Grulichova