Showing posts with label false. Show all posts
Showing posts with label false. Show all posts

Wednesday, March 28, 2012

Tab Container Issue - Inside of Update Panel

I was attempting to have a tab container hidden (visible = false) when I load the page inside of an Update Panel. After entering in some search criteria and pressing load, the tab container would become visible, or so I thought. What I got was all of the tabs' header text just written out on one line with the first tab visible and no container. Has anyone ran into this or know a work around? Outside of that, I think this would qualify as a bug or need to be noted in the documentation that you cannot change the visibility of a Tab Container inseide of an Update Panel and expect it to work correctly.

PS. Toggling the visibility of the Tab Containers works fine when the Tab Container is outside of an Update Panel.

Hi,

I fail to reproduce the issue. Can you show me your code?

Saturday, March 24, 2012

tab visible to false at runtime??

The text of the tab shows up. How do I deal with that?

I found an answer:

http://forums.asp.net/p/1123799/1761705.aspx

Wednesday, March 21, 2012

TabContainer question.

Hi,
After reading some messages on this forum, I finally found an issue to my problem about the headerText that displays when I set to false the visible tabpanel.
I use this syntax
TabContainter[1].Enabled=false;

Now I really need help on this topic.
As I said, I have a tabcontainer with 3 tabpanels.
When I am in "created" mode (that means the user will create a new item), it's only the first tabpanel is displayed.
So I what I want is when the user presses the "Add" button of the first TabPanel, the 2 other panels become visible.

I thank you in advance for your precious help.
Stan

Here's a part of my current code that doesn't work (of course)..

<cc1:TabContainer ID="myTabContainer" runat="server" Width="905" >
<cc1:TabPanel ID="myFistTab" runat="server" HeaderText="Identité">
<ContentTemplate>
<asp:UpdatePanel ID="upd" runat="server">
<ContentTemplate>
<asp:TextBox ID="txtname" runat="server" /><br />
<asp:Button ID="btnupd" OnClick="btnupd_Click" runat="server" Text="Add" />
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="mySecondTab" runat="server" HeaderText="Details">
<ContentTemplate>bla bla</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="myThirdTab" runat="server" HeaderText="Stats" >
<ContentTemplate>Bla bla</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>

The code behind

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
myTabContainer.Tabs[1].Enabled = false;
myTabContainer.Tabs[2].Enabled = false;
}
}

protected void btnupd_Click(object sender, EventArgs e)
{
updateDataBase();
myTabContainer.Tabs[1].Enabled = true;
myTabContainer.Tabs[2].Enabled = true;
}


I think you need to set AutoPostBack on the TabContainer to "true":

<cc1:TabContainer ID="myTabContainer" runat="server" AutoPostBack="true" Width="905" >

If that doesn't solve your problem, try removing the current UpdatePanel you have inside the tabPanel and wrapping the entire TabContainer in an UpdatePanel and see if the tabs show when btnupd_Click event fires.


Kylen,

I test with AutoPostBack sets to true. It doesn't work.
If I remove the UpdatePanel that is inside the TabPanel, everything works, but all the page is reloaded.
I suppose I have to call a jscript function to "enabled" the tabs but I don't know how to do it.
Stan


Hi Stan,

The right suggestion has been given by Kylen. Here is the sample. Hope it helps.

ASPX Code:

<%@. Page Language="C#" AutoEventWireup="true" CodeFile="TabTest.aspx.cs" Inherits="TabTest" %><%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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"> </asp:ScriptManager> <asp:UpdatePanel ID="upd" runat="server"> <ContentTemplate> <cc1:TabContainer ID="myTabContainer" runat="server" Width="905"> <cc1:TabPanel ID="myFistTab" runat="server" HeaderText="Identité"> <ContentTemplate> <asp:TextBox ID="txtname" runat="server" /><br /> <asp:Button ID="btnupd" OnClick="btnupd_Click" runat="server" Text="Add" /> </ContentTemplate> </cc1:TabPanel> <cc1:TabPanel ID="mySecondTab" runat="server" HeaderText="Details"> <ContentTemplate> bla bla</ContentTemplate> </cc1:TabPanel> <cc1:TabPanel ID="myThirdTab" runat="server" HeaderText="Stats"> <ContentTemplate> Bla bla</ContentTemplate> </cc1:TabPanel> </cc1:TabContainer> </ContentTemplate> </asp:UpdatePanel> </form></body></html>

If any problems, please let me know!