Showing posts with label tab. Show all posts
Showing posts with label tab. Show all posts

Monday, March 26, 2012

TreeView within TabPanel - TabControl resets to first tab

Hi!

I have a TabPanel-Conrol with 3 TabPanels. In the 2nd and 3rd one I got a TreeView. Whenever I select an item of the treeview the TabControl "resets" itelself to the first Tab, which I don`t want of course. Did I miss something?

Regards and thanks,

Martin

Have a look at:http://forums.asp.net/thread/1579184.aspx

Wednesday, March 21, 2012

Trouble with Accordion Panel inside a Modal Popup

When I use modal popup to show the tab control and other controls, the modal popup resizes correctly. Granted, the shadow behind does not, but this is avoidable by removing the drop shadow. The problem comes when I try to use an accordion panel inside a modal popup. The accordion panel doesn't respond well to clicks and the modal popup window does not resize to compensate for the dynamic panel. I encased the accordion panel in a regular panel so I could give the modalpopup extender's popupcontrolID something to play with.

I'm sure I'm doing something wrong here, but I cannot figure out what is happening exactly. Anyone experienced anything similar to this or know of a solution? Thanks!Big Smile

Bump?Angel

Trying to Dynamically Populate a Tab

Good Afternoon. Please forgive me for my lack of knowledge on AJAX. I am learning this because my work asked me to and I am trying work with the the TAB Control.

I have a database table that has a category field and a question field. I am able to popuplate the name of the tab when I select a disctinct category, but when I try to add something for the Content Template I receive an error. My final goal is for someone to choose one of the tabs (based off of my categories) and display a list of questions. All coming from a database table. Please look at this image and let me know what I am doing wrong.

Thanks in advance

Error

You cannot use ContentTemplate like that. ContentTemplate is the set of controls to display under the tab (body), not the label of the tab itself.

.HeaderText = "Jason" would put the text Jason in the tab.


I have already got the label name populated with the distinct cateogry. I am trying to figure out how to populate the body of each label with the appropriate questions from the database. I just put "jason" in to see if I would get the same error and I did.

In my while loop I generate the headertext of the label with CategoryNames("Category") When I try to populate the ContentTemplate with ("jason") or I try to make a call to the database to get all the questions that are associated to the category name, I get that error that I posted.

I hope I am making sense.

Thanks


This is an example of how to populate a tab dynamically. I must accept this is not very intuitive nor there is documentation about this.

==========================

Default.aspx

==========================

<%

@.PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default" %>

<!

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>

</

head>

<

body><formid="form1"runat="server"><asp:ScriptManagerID="ScriptManager1"runat="server"/><div><ajaxToolkit:TabContainerID="TabContainer1"runat="server"></ajaxToolkit:TabContainer> </div></form>

</

body>

</

html>

============================

Default.aspx.cs

===========================

using

System;

using

System.Data;

using

System.Configuration;

using

System.Web;

using

System.Web.Security;

using

System.Web.UI;

using

System.Web.UI.WebControls;

using

System.Web.UI.WebControls.WebParts;

using

System.Web.UI.HtmlControls;

public

partialclass_Default : System.Web.UI.Page

{

protectedvoid Page_Load(object sender,EventArgs e)

{

if (!this.IsPostBack)

{

int n = 3;while (n > 0)

{

AjaxControlToolkit.

TabPanel oTabPanel =new AjaxControlToolkit.TabPanel();

TabContainer1.Tabs.Add(oTabPanel);

oTabPanel.ContentTemplate = Page.LoadTemplate(

this.TemplateSourceDirectory +"\\WebUserControl.ascx");WebControl oWB =newWebControl(HtmlTextWriterTag.Div);

oTabPanel.ContentTemplate.InstantiateIn(oWB);

oTabPanel.HeaderText =

"Test" + n.ToString();

oTabPanel.SetRenderMethodDelegate(RenderA);

n--;

}

}

}

privatevoid RenderA(HtmlTextWriter output,Control container)

{

output.WriteLine((

"Position ") + ((AjaxControlToolkit.TabPanel)container).HeaderText);

}

}

=====================================

WebUserControl.ascx

=====================================

<%

@.ControlLanguage="C#"AutoEventWireup="true"CodeFile="WebUserControl.ascx.cs"Inherits="WebUserControl" %>

<

ajaxToolkit:TabPanelID="TabPanel1"runat="server">

<

ContentTemplate></ContentTemplate>

<

HeaderTemplate></HeaderTemplate>

</

ajaxToolkit:TabPanel>

=====================================

WebUserControl.ascx.cs

=====================================

using

System;

using

System.Data;

using

System.Configuration;

using

System.Collections;

using

System.Web;

using

System.Web.Security;

using

System.Web.UI;

using

System.Web.UI.WebControls;

using

System.Web.UI.WebControls.WebParts;

using

System.Web.UI.HtmlControls;

public

partialclassWebUserControl : System.Web.UI.UserControl

{

protectedvoid Page_Load(object sender,EventArgs e)

{

}

}


Thank you, This is going to sound bad, but I don't know C# so I will need to transfer this to VB.

Thanks Again, I will try first thing monday morning.


I've been trying to use this method but there seems to be some code missing -

In oTabPanel.SetRenderMethodDelegate(RenderA) what should be passed to RenderA?

Thanks