Showing posts with label contains. Show all posts
Showing posts with label contains. Show all posts

Wednesday, March 28, 2012

Tab Container within an Update Panel

I am working on a page that contains a grid within an update panel. The user selects an item from the grid, popping up a draggable panel with the details of the item they selected.

I want to be able to have a tab control within the pop up, but am running into some issues. The backgrounds of the tab headers dont show up. It looks to me like the styles arent getting sent to the browser because the control is being added to the page through the update panel. When I move the tab control outside of the update panel, or add another one to the page that is visible on page load it looks fine.

I was about to add another tab container to the page and set the display to none but that seems like a hack. I was wondering if there is any other way to get the styles for the tab container down to the page on load without having to do something like that.

Thanks for the help in advance,
James Hollister
Ascending Integration Inc.
www.AscendingIntegration.com

The tab control should be outside that UpdatePanel or inside a new UpdatePanel to work. Makes sense?

If you, please post the code and let's figure it out.


I'm having the same issue with the TabContainer styles not being sent to the browser, did anyone find a solution for this?

The tab container itself contains ajax functionality

Most Controls that contain built in ajax functionality dont work well in an UpdatePanel because the javascript does not gets send in an update panel during partial updates

You will need to keep the tab container outside of an update panel.

This however causes the problem of the tab container state not being updated from the code behind. For example i was not able to change the active tab from code behind in a partial postback.

The turnaround for this was that i used javascript

the below code shows how exactly

first io create a javascript function to change the active tab index

function ChangeTab(indx)

{

$find('<%=TabContainer1.ClientID%>').set_activeTabIndex(indx)

}

$find('<%=TabContainer1.ClientID%>') gets a reference to the tab container object in the javascript

then called this from code behind using the following

ScriptManager.RegisterStartupScript(Me, updButtonBar.GetType,"KEY","ChangeTab(2);",True)

here the me is the page and updbuttonbar is the update panel . It can be any update panel in the page.

In this way you can manipulate the tab container by calling any of the methods of the tab container javascript object.

If you want to find the listing of the methods save As the page containing the tab container as a complete web page on ur local hard drive

in one of the resources file u can find the methods the javascript object tab container contains or perhaps download the ajax control toolkit source

This ways was good enough for me.

Let me know if it helps

Cheers

Sohail Sayed


No this is not true - UpdatePanel does incremental loading of the scripts.

I'm not able to repro this. On the sample page, I wrap the TabContainer in an UpdatePanel and it works fine.

Can someone please post a repro?


I would do, but the situation in which this problem has arisen for me is a little bit complicated, since i'm building a custom webpart based draggy droppy affair. The TabContainer is in an UpdatePanel, which is in another UpdatePanel, and i'm creating it programatically.

I'll have a quick play, and see if i can get it to happen in a simpler scenario.


Ok, this is a much simplified reproduction of my page, but it causes the "bug". I need to add a TabContainer dynamically as the result of a button press, and in the following conditions, it appears with no styles on it.

<html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> </div><asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional"><ContentTemplate><asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></ContentTemplate></asp:UpdatePanel></ContentTemplate></asp:UpdatePanel> </form></body></html>
 
 
protected void Page_Load(object sender, EventArgs e) { }protected void Button1_Click(object sender, EventArgs e) { AjaxControlToolkit.TabContainer tbc =new AjaxControlToolkit.TabContainer(); AjaxControlToolkit.TabPanel tbp1 =new AjaxControlToolkit.TabPanel(); tbp1.HeaderText ="Test Panel 1"; Literal ltrl1 =new Literal(); ltrl1.Text ="Panel 1 Content"; tbp1.Controls.Add(ltrl1); tbc.Tabs.Add(tbp1); AjaxControlToolkit.TabPanel tbp2 =new AjaxControlToolkit.TabPanel(); tbp2.HeaderText ="Test Panel 2"; Literal ltrl2 =new Literal(); ltrl2.Text ="Panel 2 Content"; tbp2.Controls.Add(ltrl2); tbc.Tabs.Add(tbp2); UpdatePanel2.ContentTemplateContainer.Controls.Add(tbc); }

The problem that I am having along these lines is that when either the TabContainer itself or whatever container it is in (ex. Panel) is set to Visible=false; then on the partial page load the styling is not loaded. From my understanding it adds a <link> to the header when the page is loaded but this doesn't work if the control was not visible when the page was initially rendered. When the TabContainer is rendered everything is there and it works but you can't see the tab but only the HeaderText. All of the styling is lost.

Any idea of how to get around this? My thought was to add the <link> when the page is first loaded but I'm can't find anything about how to do this.

Luke


I'm having the same problem.

If I create a TabContainer dynamically (through OnInit) or initially set the TabContainer.Visible = false, the styling does not load.


Hi,

Unfortunatelly TabContainer does not properly load CSS if it first appears on the page in UpdatePanel with async update postback. However, it is quite easy to solve this, by adding an empty TabContainer somewhere to the page, but utside any UpdatePanel. Empty TabContainer without any Tabs does not render anything noticable to the page, but it loads CSS which is later used by other TabContainers.

So, add a TabContainer without pages to your page and make sure it is not in UpdatePanel and it its Visible = true.

-yuriy
http://couldbedone.blogspot.com


That did the trick. I added the following code and it works just like I want it to.

</asp:UpdatePanel>
<ajaxToolkit:TabContainerID="tabNotUsed"runat="server"Visible="true"/>

Thanks for the help!

Luke

Saturday, March 24, 2012

TabContainer and DropDownList

Hi!

I've got a User Control that contains a DropDownList with AutoPostBack=true and theSelectedIndexChanged event is wired.

I've tested my User Control in a blank .aspx page and it works fine!


Now, if I add this User Control in a TabContainer and run it again, it stoppes behaving as it should: SelectedIndexChanged doesn't trigger and the list is empty after postback.

Has anybody experienced the same kind of problem?

Thanks!

Hi,

Please post your code so i can review it and then give you a logical explanation for this


Hi ,

You could try adding an UpadatePanel inside the Tab and then add the user control inside the Updatepanel.

George

TabContainer and TabPanel

I'm trying to build a fairly customized TabContainer... which contains TabPanels that can be closed or opened by the user (except the first TabPanel which is always available), also with different styles, colors, etc. How can the TabContainer be customized ? And does it support client-side closing/hiding TabPanels ?

Check out the sample:http://www.asp.net/AJAX/Control-Toolkit/Live/Tabs/Tabs.aspx

Check out the section namedTabs Theming for how to style the control.

-Damien


Thanks for the answer... but

What about allowing the user to close/open tabs without using code-behind functions?


I don't believe there is way to hide them client side. You can set theEnabled property though client side according to that link I sent you.

TabPanel Properties
"Enabled - Whether to display the Tab for the TabPanel by default. This can be changed on the client."

-Damien

Wednesday, March 21, 2012

TabContainer AutoPostBack. Load the tabPanels only when needed

Greetings!I have a TabContainer with various tab.

Each tabPanel contains a Gridview that contains different data. This way, each time the page loades or makes a postback ALL the gridviews perform the data access.

In order to increase performance at the first page_load, I want that the methods that load the Gridviews excecute only when the tab is activates. The solution that I tried was to capture the ActiveTabChange event. The problem is that the TabContainer doesn't have any AutoPostBack-like property.

Any ideas=

Hello,

There's a function on the TabContainer called OnActiveTabChanged


If you READ (yes READ) my post, you will see that I know that there is that event, and I also say that it doesn't solve by its own my problem. Yes I do capture that event and code the data access there. But when the user clicks on a tab, this event doesn't fire up, because this events activates on postback (for example, if anyone clicks a button).

Pleas avoid answering if you don't read the entire post.

Anyone with REALLY helpful ideas?


Oops, sorry. I guess I must have skipped that line of yours. Cheer.

TabContainer Control

Hi,

I am facing an issue with the tabcontainer control. Inside the tabPanel i have an updatepanel which contains a linkbutton set as a trigger to update the content of the tabPanel.

Somehow the server side click event of the linkbutton is not getting fired.

Below is my code snippet :

 <cc1:TabContainer id="Tabs1" runat="server" OnClientActiveTabChanged="ActiveTabChanged" Height="150px"> <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Inbox" CssClass="tabClass" > <ContentTemplate><!--E-Claims form system--> <asp:UpdatePanel ID="claimUpdate" runat="server"> <ContentTemplate><!--Panel to hide the content--> <asp:Panel ID="panel4" runat="server" CssClass="fontClass" BackColor="#082f73" width="682"> <div style="padding:5px; cursor: pointer; vertical-align: middle;"> <div style="float: left;">E-Claim</div> <div style="float: right; margin-left: 20px;" > <asp:LinkButton ID="lnk2" runat="server" Text="Show Details" ForeColor="#ffffff"/> </div> </div> </asp:Panel><!--Content to show--> <asp:Panel id="panel3" runat="server"> <asp:UpdatePanel ID="updatePanel2" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:GridView ID="grid2" runat="server"> </asp:GridView> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="lnk2" EventName="Click" /> </Triggers> </asp:UpdatePanel>   </asp:Panel> </ContentTemplate> </asp:UpdatePanel> <cc1:CollapsiblePanelExtender ID="CollapsiblePanelExtender2" runat="server" TargetControlID="panel3" ExpandControlID="panel4" CollapseControlID="Panel4" Collapsed="True" TextLabelID="lnk2" CollapsedText="Show Details.." ExpandedText="Hide Details.." > </cc1:CollapsiblePanelExtender> </ContentTemplate> </cc1:TabPanel> </cc1:TabContainer>

I too am facing a similar issue.I have a simple tabcontainer control on a page and within its tabpanel, an asp:button. Clicking on the button doesnt raise any server side event. I have tried several things but nothing seems to work. The moment i remove the tabcontainer, it works just fine.

Thanks.


Hi,

I tried it, the click event handler fired. Here is my code:

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void lnk2_Click(object sender, EventArgs e) { }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <input type="button" onclick="access()" /> <script type="text/javascript" src="JScript.js"></script> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>   <ajaxToolkit:TabContainer id="Tabs1" runat="server" Height="150px"> <ajaxToolkit:TabPanel ID="TabPanel1" runat="server" HeaderText="Inbox" CssClass="tabClass" > <ContentTemplate><!--E-Claims form system--> <asp:UpdatePanel ID="claimUpdate" runat="server"> <ContentTemplate><!--Panel to hide the content--> <asp:Panel ID="panel4" runat="server" CssClass="fontClass" BackColor="#082f73" width="682"> <div style="padding:5px; cursor: pointer; vertical-align: middle;"> <div style="float: left;">E-Claim</div> <div style="float: right; margin-left: 20px;" > <asp:LinkButton ID="lnk2" runat="server" Text="Show Details" ForeColor="#ffffff" OnClick="lnk2_Click"/> </div> </div> </asp:Panel><!--Content to show--> <asp:Panel id="panel3" runat="server"> <asp:UpdatePanel ID="updatePanel2" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:GridView ID="grid2" runat="server"> </asp:GridView> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="lnk2" EventName="Click" /> </Triggers> </asp:UpdatePanel> </asp:Panel> <ajaxToolkit:CollapsiblePanelExtender ID="CollapsiblePanelExtender2" runat="server" TargetControlID="panel3" ExpandControlID="panel4" CollapseControlID="Panel4" Collapsed="True" TextLabelID="lnk2" CollapsedText="Show Details.." ExpandedText="Hide Details.." Enabled="True" > </ajaxToolkit:CollapsiblePanelExtender> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> </ajaxToolkit:TabPanel> </ajaxToolkit:TabContainer> </div> </form></body></html>

TabContainer hidden on postback!

i have a page that is derived from a master page. The page contains a tabContainer with three TabPanels. Each of the TabPanels contains an updatePanel.

One of the updatePanels contains a TabContainer with two Tabpanels that contain CascadingDropdowns. Everything works fine till i perform a postback

from within the update panel. Upon return the inner most tabContainer is hidden -- i can see it in ViewSource, but it is set to hidden and display of none.

There are no exceptions in the code. The Page Load event completes perfectly, the event handler for the button that causes the postback executes

perfectly. everything works, except that the tabContainer is "gone"...

If i remove the UpdatePanel that contains the tabContainer then everything works. Putting back the UpdatePanel causes the inner TabContainer to

disappear on postback even though everything works in the code behind. I tried to explicitly set the TabContainer to enabled and visible in Page Load

event to no avail. I do not know if the fact that the page is derived from a master page makes a difference.

summary of hierarchy

MasterPage

-- ClientPage

-- TabContainer

-- TabPanel

-- UpdatePanel -->this seems to cause the problem on postback.

-- TabContainer --> disappears on postback

-- TabPanel --> this works, has no TabContainers

-- TabPanel -->this works, has no Tabcontainers

Help??!!!


i found the solution to all the problems i've been having with tabs disappearing upon deployment.

Turns out the microsoftajax.js was different. Reinstalling Ajax extensions fixed it. The problem i

have with this is that this was the released v1.0 that was installed. The machine had no atlas, no

previews, no nothing before Ajax 1 was installed on it few weeks ago. Downloading and re-installing

fixed it, but clearly installed a different set of files... The hint that finally got me to this path was

issues with sys.debug that were not related to caching the js files in the browser nor in IIS.



I downloaded the latest controltoolkit.dll, however, I am still having the same problem with firefox as you had above.

Any suggestions?

Thanks


Hi,

If anyone is still having this issue....

Firefox had a bug. I just downloaded the latest release of Firefox from this link: (I guess it is not officially released?)

ftp://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2007-03-09-19-firefox2.0.0.3

In the new Firefox, the tabContainer seems to work fine.

Thanks

TabContainer Firefox problem

I am using tabContainer for tabed navigation with update panels inside tabpanel for async updates to the server.

Ome tab panel contains FCKEditor. I have experinced 2 errors on the page when using Firefox:

1. The page is loading very slowly and the following message is displayed in the status bar:
"Transfering data from localhost"

2. FCKEditor when used inside tab panel and updatepanel will losse the text entered when I try to update asinc to the server.

I have tried the following solution but it did not work:
http://jlcoady.net/archive/2007/03/30/fckeditor-work-inside-updatepanel

The most relevant error in Error console seems to be the following:
Warning: Error in parsing value for property 'display'. Declaration dropped.
Source File:http://localhost:56780/WebResource.axd?d=MJBzFYTfWN4CIFiUGFH5fLnKi97ZUvWrbLbcxzkrjzR4fE38RehHyps3lRxPqwg76Z_83olVsuwUqCCjsO2ZJw2&t=633130226175471389
Line: 5

With the following data:

/* default layout */.ajax__tab_default .ajax__tab_header {white-space:nowrap;}.ajax__tab_default .ajax__tab_outer {display:-moz-inline-box;display:inline-block}.ajax__tab_default .ajax__tab_inner {display:-moz-inline-box;display:inline-block}.ajax__tab_default .ajax__tab_tab {margin-right:4px;overflow:hidden;text-align:center;cursor:pointer;display:-moz-inline-box;display:inline-block}

There is also a bunch of css errors.

Needless to say everything works perfectly in IE 7.

Any help/suggestions will be greatly appreciated.

P.S. To isolate the problem - I have taken fckeditor out of the page and everything works fine. Then I added FCK Editor outside of update panel and tabcontainer and the problem reappeared, hence it is safe to conclude that the problem is related to FCKEditor.

Solved the problem.

FCKEditor subfolder containing all the setting,images etc for FCK Editor MUST be placed in the root folder of a web application. Probably there is a way to do it but it is not an issue any more.