Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > AJAX Tab Control View modes: 
User avatar
Member
Member
bkehren-aanem - 8/7/2009 9:08:02 AM
   
AJAX Tab Control
I would like to utilize the AJAX ToolKit TabControl on a page but not sure how to include those controls within my website. Any suggestions or thoughts or a webpart that utilizes the AJAXToolKit?

User avatar
Member
Member
Peter - 8/10/2009 12:05:00 AM
   
RE:AJAX Tab Control
Hi,
create a new webpart and in the webpart code it as you would in aspx page.

<ajaxToolkit:TabContainer runat="server" ID="Tabs" ActiveTabIndex="0">
<ajaxToolkit:TabPanel runat="server" ID="TabPanel1" HeaderText="My Tab Panel1">
<ContentTemplate>
This is my Panel 1
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel runat="server" ID="TabPanel2" HeaderText="My Tab Panel2">
<ContentTemplate>
This is my Panel 2
</ContentTemplate>
</ajaxToolkit:TabPanel>
</ajaxToolkit:TabContainer>


User avatar
Member
Member
FroggEye - 8/12/2009 8:30:03 AM
   
RE:AJAX Tab Control
Sure this gives me a one time use of the webpart but I want it to be something which could be used on several different pages and have dynamic content vs. the static content you list above.

User avatar
Member
Member
Peter - 8/12/2009 10:55:30 PM
   
RE:AJAX Tab Control
If you mean adding tabs dynamically, you can use something like this

AjaxControlToolkit.TabPanel tab = new AjaxControlToolkit.TabPanel();
tab.HeaderText = "New Tab 1";
TabContainer1.Tabs.Add(tab);

User avatar
Member
Member
FroggEye - 8/13/2009 8:50:02 AM
   
RE:AJAX Tab Control
Thanks Peter. I have those basics down, just want to know how to tie that to the front end where a user could enter the number of tabs they want and header text for each tab as well as content for each tab in the configuration of the web part. Still very new to Kentico and trying to learn this web part stuff. Thanks for the help

User avatar
Member
Member
Peter - 8/13/2009 6:29:42 PM
   
RE:AJAX Tab Control
I would suggest to have a look in the Kentico CMS Developer's Guide at "Developing web parts" chapter. Particularly at Properties of a webpart.
So in your case you could have a property which would store the names of tabs maybe comma delimited and in the page_load method you extract this text

//TabsHeads is the property name which you would setup when adding your webpart to a page (this property has to be registered when you are registering the webpart)

string[] myTabsHeads = (string) PartInstance.GetValue("TabsHeads").Split(',');

Now you have an array of headings for your tabs and you can start to create them with for example editabletext webpart inside each tab. Again this can be configured via properties of the webpart.

I hope this helps you a bit.