2 posts, 0 answers
  1. Dev
    Dev avatar
    2 posts
    Member since:
    Nov 2011

    Posted 05 Feb 2013 Link to this post

    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);
    now i would like to add template to each of those rad tabs as in static code say for example 
    <telerik:RadTabStrip ID="radTabStripSamples" runat="server" OnTabClick="radStripHardwareBrowser_Click">

            <telerik:RadTab Text="Sample1" runat="server">
      //would like to generate this table inside the tab template of the individual tab from cs code //

    from C# code, after adding the tabs dynamically.So,I tried something like this 
    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;
    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
  2. Plamen
    Plamen avatar
    2723 posts

    Posted 08 Feb 2013 Link to this post


    Here is the help article that should be helpful. Please let me know if you have further questions.

    All the best,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. DevCraft R3 2016 release webinar banner
Back to Top