This is a migrated thread and some comments may be shown as answers.

How to add a label inside a childtab dynamically

2 Answers 27 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Marc Plaxton-Harrison
Top achievements
Rank 1
Marc Plaxton-Harrison asked on 13 Oct 2016, 02:08 PM

Good day,

lately i have been battling with adding a label control inside a child tab so that i could display the challengers on after clicking on that tab

here is my code below...

private void LoadTournament(EventCollection eventCollection, RadTabStrip radTabStrip)
       {
           RadMultiPage Multiview = new RadMultiPage();
           Multiview.ID = "Multiview1";
          RadPageView PageView = new RadPageView();
           //Pageview.ID = "";
           //Pageview.ID ="";
 
          
           foreach (RadTab tb in radTabStrip.Tabs)
           {
               int iSportId = int.Parse(tb.Value);
               tb.ScrollChildren = true;
 
               foreach (var ev in eventCollection.Events)
               {
                   if (ev.SportID == iSportId)
                   {
                       // Create new to a RadTab.
                       RadTab tab = new RadTab();
                       tab.Value = ev.TournamentID.ToString();
                       tab.Text = ev.Tournament;
                   
                       tb.Tabs.Add(tab);
                       foreach (var item in ev.Challengers)
                       {
                           Label label = new Label();
                           label.Text = item.Name;
 
                           tb.PageViewID = "Page1";
                           tb.SelectedIndex = tab.Index;
 
                           radTabStrip.MultiPageID = "Multiview1";
                           //        RadPageView PageView = loadchallenger(eventCollection);
                           PageView.ID = "Page1";
                           PageView.Height = 500;
                           Multiview.PageViews.Add(PageView);
 
                       }
                     
                        
                       //foreach (var item in ev.Challengers )
                       //{
                       //    TextBoxTemplate template = new TextBoxTemplate();
                       //    Label label = new Label();
 
                       //    label.Text = item.Name;
                       //    Pageview.Controls.Add(label);
                          
                                                
                       //}
                      
                   }
               }
                
           }
       }

 

I would like to add labels inside a child tab please help anyone,

please below capture

 

2 Answers, 1 is accepted

Sort by
0
Marc Plaxton-Harrison
Top achievements
Rank 1
answered on 17 Oct 2016, 07:21 PM

Good day guys,

its been 3 days since i posted, is there support on this?

kind regards

Marc

0
Nencho
Telerik team
answered on 18 Oct 2016, 10:14 AM
Hello Marc,

First, I would like to draw your attention to the fact that the dynamically created MultiPage is never added in any Controls collection on your page. This is the main reason for the inability to add and show the needed label.

I can suggest you to have it statically initialized in your markup, in order to easily position it under the TabStrip.

In the attachment you can find a sample example on such implementation and adding the needed labels.


Regards,
Nencho
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
TabStrip
Asked by
Marc Plaxton-Harrison
Top achievements
Rank 1
Answers by
Marc Plaxton-Harrison
Top achievements
Rank 1
Nencho
Telerik team
Share this question
or