Hi,
I have a rad strip defined on my aspx page as follows,
I am generating the tabs for the above tabstrip using C# code as follows
now i would like to add template to each of those rad tabs as in static code say for example
from C# code, after adding the tabs dynamically.So,I tried something like this
I do not know whether am using the right approach.Would like to see a sample to do the same or any documentation. Thanks you for your help
I have a rad strip defined on my aspx page as follows,
<telerik:RadTabStrip ID="radTabStripSamples" runat="server" OnTabClick="radStripHardwareBrowser_Click"/>I am generating the tabs for the above tabstrip using C# code as follows
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List<Category> lstCategories = new List<Category>(); lstCategories = Service.GetCategories(); int numberOfCategories = lstCategories.Count; CreateTabs(numberOfCategories, lstCategories); } } protected void CreateTabs(int numberOfCategories, List<Category> lstCategories) { for (int i = 0; i < numberOfCategories; i++) { RadTab tab = new RadTab(lstCategories[i].Name); radTabStripSamples.Tabs.Add(tab); } }<telerik:RadTabStrip ID="radTabStripSamples" runat="server" OnTabClick="radStripHardwareBrowser_Click">
<Tabs> <telerik:RadTab Text="Sample1" runat="server"> <TabTemplate> <table> //would like to generate this table inside the tab template of the individual tab from cs code // </table> </TabTemplate> </telerik:RadTab></Tabs>
</telerik:RadTabStrip
RadTemplateItem template = new RadTemplateItem();tab.TabTemplate = template.InstantiateIn(tab);//-----> //this would nt work for sure because the return type is void. So would like to know how to go about this. tab.TabTemplate = template;//--->//This one did not work the way i expected it to// this simply replaced the tab name with "XyZ serires" instead of the categories names.
class RadTemplateItem : ITemplate{ public void InstantiateIn(Control container) { Table tbl = new Table(); TableRow row = new TableRow(); TableCell cell = new TableCell(); Label Name = new Label(); Name.Text = "XYZ Series"; cell.Text = Name.Text; row.Cells.Add(cell); tbl.Rows.Add(row); container.Controls.Add(tbl); }}