Showing posts with label working. Show all posts
Showing posts with label working. 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

Monday, March 26, 2012

Tab Control Error

Friends,

I am using Tab Control(developed using ATLAS,downloaded from net) in my project, it working fine.But when the Session has expired, if I click any Links on the page, will redirect to Login Page. But while clicking the Tabs in the Tab Control, its throwing an Unknown Error through Alert box.

Any Help, Thanks in Advance.

Regards,

Vasanth

Is the Tab control visible depending on the session and user? Did you add this tab control in a usercontrol so you can post it here? I would like to test it. I use that control quite a lot without any problem.

Tab Control doesnt display correctly within User Control

I've tried searching for answers to this but the search facility seems to not be working at the moment, so please forgive me if there are similar posts in here somewhere which I just can't see.

I don't know whether I'm the only person here trying to use these controlkit controls inside my own user controls, but it seems that every time I try I get mysterious problems! I'm dynamically adding Tab Panels to a Tab Container in the Container_Init function. This works beautifully in a straight aspx page, but as soon as I place the Tab Container within an ascx page, I get little white blocks appearing at runtime in front of each Tab "header" area, starting about halfway down each one and slightly offset to the left, so that only the top half of the tab header text is visible. Also there is a solid line (albeit with a tiny gap at the right-hand end) between the active tab header and the corresponding panel, so there is no sense of the header belonging to the active tab.

Any hints anyone?

_Ade.

Well I won't say I've "solved" this problem, but I have come up with a totally bizarre workaround.

By dint of tediously commenting out each element of the supplied css class line by line and rebuilding, I finally realised that the defaultajax__tab_tabclass has a hard-coded height of 13px, and in the specific case where the tab container is contained within a user control, increasing this height to 21px fixes the problem!

Does anyone know what this is all about? Will it come back and bite me again when it wakes up?

_Ade.


Try add the following to your user control:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Good luck.


I added the line and it makes no difference. Unless I change the ajax__tab_tab class Height from 13px to 21px it doesn't display correctly.

_Ade.


Where did you add it to? Try to add it to the page consuming the user control to see if works.


Yep, it worked!

10xvljw8202.


Well actually, it did fix the tab display, but it screwed up the formatting of the rest of the page and every other page in my application!

I'm sticking with resetting the css file to 21px height.

_Ade.


Please help !

I have set the height as 21 px as mentioned, but the tags are still broken.

Is there anybody experience the same problem?

Thanks


Found out the solution finally.

I put the code "<script language='Javascript'>window.resizeTo(screen.width,screen.height); self.moveTo(0,0);</script>" on aspx.vb file.

In order to solve the broken tags problem. remove the code from .aspx.vb file, and put them into .aspx file.

I hope it helps.

Tab Control Not working Properly in Update Panel.

I am having one update panel. inside that having some ASP Controls and a Tab Control. Now whenever this Update panel tries to Update, My tab control gets disappeared. It is not displyaed on the page.

Can you elaborate on what you are trying to do eg.

UpdatePanel -> Tab Container -> Tab - Some ASP.NET controls

Also, are you doing this in the Designer in Visual Studio? ie drag and drop designing.? otherwise?


Hi mistry,

To indicate the real problem, your source code is needed.However , here is the url that has a sample shows how to use these controls (Please focus on the source code). Hope it helps.

http://forums.asp.net/p/1128124/1784927.aspx#1784927

If your problem is still exist, please let me know.


Hi,

I tried what you described, it worked fine. 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 Page_Load(object sender, EventArgs e) { Label1.Text = DateTime.Now.ToString(); }</script><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> <ajaxToolkit:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="1"> <ajaxToolkit:TabPanel ID="TabPanel1" runat="server" HeaderText="TabPanel1"> <ContentTemplate> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> </ContentTemplate> </ajaxToolkit:TabPanel> <ajaxToolkit:TabPanel ID="TabPanel2" runat="server" HeaderText="TabPanel2"> <ContentTemplate> <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </ContentTemplate> </ajaxToolkit:TabPanel> </ajaxToolkit:TabContainer> <asp:Button ID="Button1" runat="server" Text="Button" /> </ContentTemplate> </asp:UpdatePanel> </form></body></html>
You may compare it with your code to find out the reason.

Tab Control Problem

Hi

I m using Ajax Tab Control in my application it is working fine but with one problem. I have three tab pages on the tab control. Every tab page has a data grid and that cause the page to post back. The problem is when I do some post back on tab and then move to another tab and cause the page to post back the tab control select the previous tab on the current on which I am working.

Is there something that I m missing ??

http://forums.asp.net/p/1068120/1550723.aspx#1550723


hi

But the solution over there is not working for me. Any other idea/workaround??


Did you try the solution by Howeird? That worked for me.


Use updatepanels around your grids.. That should prevent full postbacks.. If I understood your problem right, that should solve it..

Tab Controls and CssClass Not Working

I have been working with the tab Control for two days with no success at overridding the default styles for the tabs. I have copied the styles from the tabs.css file located in the toolkit, and have modified the hover, active and selected styles that I want to modiy. I have included the new css sheet into my application and included the CssClass reference in the file code. when I run the page or site to debug I get the default images and actions. Could anyone tell me what is wrong. I'm including the source code below:

ASP file

<%@dotnet.itags.org.PageLanguage="VB"AutoEventWireup="true"CodeFile="Default.aspx.vb"Inherits="_Default" %>

<%@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

<linkhref="Tabs.css"rel="stylesheet"type="text/css"/>

</head>

<body>

<formid="form1"runat="server">

<asp:ScriptManagerID="ScriptManager1"runat="server"/>

<div>

<cc1:TabContainerID="TabContainer1"runat="server">

<cc1:TabPanelID="TabPanel1"runat="server"CssClass="ajax__tab_tab1">

<HeaderTemplate>DashBoard</HeaderTemplate>

</cc1:TabPanel>

</cc1:TabContainer>

</div>

</form>

</body>

</html>

Style sheet

/* 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}

/* tab1 theme */

.ajax__tab_tab1.ajax__tab_header {font-family:verdana,tahoma,helvetica;font-size:11px;background:url(<%=WebResource("AjaxControlToolkit.Tabs.tab-line.gif")%>)repeat-xbottom;}

.ajax__tab_tab1.ajax__tab_outer {padding-right:4px;background:url("Images\green_gradient_3.gif")no-repeatright;height:21px;}

.ajax__tab_tab1.ajax__tab_inner {padding-left:3px;background:url("Images\green_gradient_1.gif")no-repeat;}

.ajax__tab_tab1.ajax__tab_tab {height:13px;padding:4px;margin:0;background:url(<%=WebResource("AjaxControlToolkit.Tabs.tab.gif")%>)repeat-x;}

.ajax__tab_tab1.ajax__tab_hover.ajax__tab_outer {background:url(<%=WebResource("AjaxControlToolkit.Tabs.tab-hover-right.gif")%>)no-repeatright;}

.ajax__tab_tab1.ajax__tab_hover.ajax__tab_inner {background:url(<%=WebResource("AjaxControlToolkit.Tabs.tab-hover-left.gif")%>)no-repeat;}

.ajax__tab_tab1.ajax__tab_hover.ajax__tab_tab {background:url(<%=WebResource("AjaxControlToolkit.Tabs.tab-hover.gif")%>)repeat-x;}

.ajax__tab_tab1.ajax__tab_active.ajax__tab_outer {background:url("Images\green_gradient_4.gif")no-repeatright;}

.ajax__tab_tab1.ajax__tab_active.ajax__tab_inner {background:url("Images\green_gradient_3.gif")no-repeat;}

.ajax__tab_tab1.ajax__tab_active.ajax__tab_tab {background:url("Images\green_gradient_1.gif")repeat-x;}

.ajax__tab_tab1.ajax__tab_body {font-family:verdana,tahoma,helvetica;font-size:10pt;border:1pxsolid#999999;border-top:0;padding:8px;background-color:#ffffff;}

/* scrolling */

.ajax__scroll_horiz {overflow-x:scroll;}

.ajax__scroll_vert {overflow-y:scroll;}

.ajax__scroll_both {overflow:scroll}

.ajax__scroll_auto {overflow:auto}

thank you,

kkof

You should apply the CssClass attribute to the TabContainer control rather than to the TabPanel element.

Kind regards,

sbogus.


Thanks sbogus, placing the CssClass on the TabContainer corrected the issues I was having.

Tab Panel

Hello Everyone,

I've been working with the tab panel example in the AJAX Control Toolkit and I have a problem I just cannot seem to solve. How would I cause a click on a specific tab to call a specific function on the C# code behind page? Is this something I can do on the C# side? If not, you might have to give some example code as I'm a newbie at ASP.NET and Javascript. Thanks in advance.

Robert

hi Robert,

The tab Panel/container does not have an autopost back mechanism. So you must do it your self by adding;

"text/javascript"> function ActiveTabChanged(sender, e) { __doPostBack('<%= tc1.ClientID %>', sender.get_activeTab().get_headerText()); }

<scripttype="text/javascript">

function ActiveTabChanged(sender, e)

{

__doPostBack('<%= tc1.ClientID %>', sender.get_activeTab().get_headerText());

}

</script>

andset the OnClientActiveTabChanged="ActiveTabChanged"


The previous answer didn't quite do everything required for you.

Add the following script to your page:

<script type="text/javascript" language="javascript">
function ActiveTabChanged(sender, e)
{
__doPostBack('<%= idofmytabcontainer.ClientID %>', sender.get_activeTab().get_headerText());
}
</script>


Then ensure your markup for the tab container has the following entries:

OnClientActiveTabChanged="ActiveTabChanged" OnActiveTabChanged="ActiveTabChangedServer"

In the page load event of your code behind file add:

ScriptManager1.RegisterAsyncPostBackControl(idofmytabcontainer);


Finally add the ActiveTabChangedServer method to the code behind file:

protected void ActiveTabChangedServer(object sender, EventArgs e)
{
if (idofmytabcontainer.ActiveTab == idoftabpanel1)
{
//Do something in code
}

if (idofmytabcontainer.ActiveTab == idoftabpanel2)
{
//Do something in code
}
}

I hope that helps


Does anyone have a sample tab panel that is working that they can paste below (or e-mail to me)? I'm making a mistake somewhere and cannot figure out where. If I had a sample tab panel that is already working correctly I can work from there. Thanks in advance.

Robert


Robert, the above code worked for me (when I checked it with a break point in Visual Studio), but the msgs I wanted to display didn't display. Then I put in an UpdatePanel around the labels and added a trigger and the messages showed. Here is what I added on the panel that was clicked:

<asp:UpdatePanelID="UpdatePanel7"runat="server">

<ContentTemplate>

<asp:LabelID="lblEmailMsg"runat="server"ForeColor="red"Font-Bold="true"/>

<asp:LinkButtonrunat="server"ID="lbtnAssignEmail"Visible="true"Text="Click here to fix this."/>

</ContentTemplate>

<Triggers>

<asp:AsyncPostBackTriggerControlID="Tabs"EventName="ActiveTabChanged"/>

</Triggers>

</asp:UpdatePanel>


Actually, here is the correct linkbutton control, but it is not really part of the solution. I just was not ready to test the link button yet so I left out the OnClick.

<asp:LinkButtonrunat="server"ID="lbtnAssignEmail"Visible="true"OnClick="OnClickPanel1"Text="Click here to fix this."/>


zoetosis,

I am using masterpages and my script manager is in the masterpage, how do I add the RegisterAsyncPostBackControl in page_load when I am using master pages.

Thanks


In VB:

ScriptManager.GetCurrent(Me.Page).RegisterAsyncPostBackControl([nameoftabcontainer])

Saturday, March 24, 2012

Tab Panel using ContentPlaceHolder not working inside Master Page.

I just downloaded the latest version of the AJAX toolkit and have noticed that with the new version my master pages now have new errors. It seems that the tab panels cant be used in master page and using contentplaceholders. Anyone have any fixes or solutions for this. The error I get is

Error 1 'AjaxControlToolkit.TabPanel.TabPanelContainer' is inaccessible due to its protection level c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\pubsubgui\6a434f43\4362c5b0\App_Web_dl4gjyhw.0.cs 185

Hi,

You can modify the access identifier of TabPanelContainer from internal to public in the source of the AjaxControlToolKit to solve it.


This should be fixed in the next release of the Toolkit due soon. Thanks!


Has this been resolved? I downloaded the Jun 18 release but I still seem to be having this issue (first time Ive used the control toolkit, so I cant tell you if it existed for me previously).

I have a content place holder in my Master page, and Im using the Tab Container/Panel control in my content page. The content pane renders blank. If I view source on the page the style for the tab container/panel is set to visibility:hidden;display:none; I have no idea why that happens but that might be part of the issue (Ive set the Style manually in the page_load but it doesnt act like a tab control, rather i just see the tab panel header text).

-Chris


Please send along a simple, self-contained demonstration of the problem for folks to have a look at. Maybe have a peek at the Tabs sample page which also uses MasterPage/ContentPage and seems to work okay.


OK, so this is my first time using AJAX, and the first control im using, and im already getting a fatal error like this?? Am I going to have problems like this with other controls? Should i wait on using AJAX?? It doesnt seem like its quite ready to use in a professional setting, with deadlines. Thanks


Hey... In general the AJAX toolkit is great and really fleshes out more for your web page. If you go and get the latest change source... this has been fixed. Go here and download and build the latest version of the code.http://www.codeplex.com/AtlasControlToolkit/SourceControl/ListDownloadableCommits.aspx


OK, isnt there a way to just download all of the fixes? I dont know what I am looking for in that link. Maybe the June 18th entry at 1:06 by davidans "take care of code analysis issue in tabpaneldesigner" ?? Sounds like person above downloaded that with now help. And how do I know where to add this souce code?? I build it into that sample project that comes with the toolkit?? And use the DLL it creates??

Tab panel is not working properly in Firefox 1.5.0.10

Tab panel is not working properly in Firefox 1.5.0.10. When ever i click on the tab , the tab panel is getting disappeared.

If I refresh the page, then the tab panel is displayed with default tab container being selected.

It works properly in 1.5.0.12.

Does any one has faced this problem ?

Hi,

According to your description, it seems this may be a issue the that version of Firefox. Although I'm not 100% sure.

If that's the case, it's hard to expect everything runs fine with it. And it would be recommended to update if an older version has a issue.

Tab Problem

Iam listing some records in a datalist inside a tab control...when the page load all tab options working perfectly.when i click first tab "client records " listed and when iam click second tab "product records" listed...my problem is...i have placed a dropdown in first tab for search option .this dropdown is set "autopostback" =true.during page load all tab easily work..but when i selected dropdown for searching, the tab controls "borken"..how can i solve that problem.please help me.....

by anish

Hi Anish,

I don't quite understand what do you mean by "broken" ? Can you elaborate it?

It will be better if you can provide a simple repro that uses NorthWind database.

Wednesday, March 21, 2012

TabContainer Server Side Event within Master Pages

I want to fire a server side event on the tab change event and I am sure it is not working beacuse of the use of a master page. Any thoughts how to get this working proerly?

1public void TabContainerPublications_ActiveTabChanged(object sender, EventArgs e)2{3string strTest;4if (TabContainerPublications.ActiveTabIndex == 0)5 strTest ="Made It!";6}

In the web form is the following:

1<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">2 <asp:ScriptManager ID="PublicationsScriptManager" runat="server">3 </asp:ScriptManager>4 <div id="publicationsheaderimage">5 </div>6 <div id="fullCol">7 <h2>8 Publications</h2>9 <ajaxToolkit:TabContainer ID="TabContainerPublications" runat="server" OnActiveTabChanged="TabContainerPublications_ActiveTabChanged">10 <ajaxToolkit:TabPanel ID="TabPanelAllPublications" HeaderText="All Publications" runat="server">11 <ContentTemplate>12 <asp:GridView runat="server" ID="GridViewAllPublications" AutoGenerateColumns="False"13 ShowHeader="False" CellSpacing="5" GridLines="None">14 <Columns>15 <asp:TemplateField>16 <ItemTemplate>17 <asp:HyperLink ID="HyperLink1" NavigateUrl='<%# Bind("articleUrl")%>' runat="server">18 <asp:Label ID="Label1" runat="server" Text='<%# Bind("articleName")%>'></asp:Label></asp:HyperLink>19 <asp:Label ID="Label2" runat="server" Text='<%# Bind("Abstract")%>'></asp:Label>20 </ItemTemplate>21 </asp:TemplateField>22 </Columns>23 </asp:GridView>24 </ContentTemplate>25 </ajaxToolkit:TabPanel>

As it turns out this was not my real issue. Since I wanted to execute a server side event I had to wrap the Tabs in an Update Panel.