Saturday, March 24, 2012

Tab Panels inside of a repeater?

I'm trying to create a dynamic amount of tabs and cannot place tab panels inside, is their a suggested alternative?

I just need tab like functionality.

Thanks alot!

-Ryan

Hi Ryan,

I'm not sure how are you trying to implement it with Repeater, but you can create TabPanel dynamically.

For instance:

AjaxControlToolkit.TabPanel tbpanel = new AjaxControlToolkit.TabPanel();
tbpanel.HeaderText = "Tab 01";
tbpanel.Controls.Add(new TextBox());
Label lb = new Label();
lb.Text = "Content";
tbpanel.Controls.Add(lb);
TabContainer1.Tabs.Add(tbpanel);

Hope this helps.


Thanks for the reply, that seems useful but I'm still a little confused how I should use it, basically this is what I need.

A Tab Container is created, inside is a repeater which, with each iteration, creates a tab panel and populates it.

So how would I add the stuff inside the panels (the stuff I've written in the aspx page)
Do I still databind?

Just confused where/how I should use that,

thanks!


So you want to populate the TabPanel dynamically? And the contents to be populated are different aspx pages?

TabPanel can't be used as a container for another page, unless wrapping a iframe inside it.

I would recommend you create UserControl(.ascx) for different content, and load it into the TabContainer.

For instance:

AjaxControlToolkit.TabPanel tbpanel = new AjaxControlToolkit.TabPanel();
tbpanel.HeaderText = "Tab 01";

if( .............. ){
Control c = this.LoadControl("relative path to the UserControl")
tbpanel.Controls.Add(c);
}
TabContainer1.Tabs.Add(tbpanel);

No comments:

Post a Comment