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

add dynamic labels to radPanelbarGroupElement.ContentPanel

9 Answers 195 Views
Panelbar (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kerri
Top achievements
Rank 1
Kerri asked on 23 Oct 2007, 05:19 PM
When I add labels dynamically to the content panel, the content panel only displays the first label added.  When I convert the labels to radLabelElements and add them directly to the groupElement, all of them display but the content panel is pushed south causing my panelbar to scroll.

This is how I add labels to the content panel (only first one shows):
Label lbl = new Label();
lbl.Text = "HI";
grpElement1.ContentPanel.Controls.Add(lbl);
Label lbl2 = new Label();
lbl2.Text = "HI2";
grpElement1.ContentPanel.Controls.Add(lbl2);

This is how I add radGroupElements to the groupElement (pushes contentPanel south):
RadLabelElement lbl = new RadLabelElement();
lbl.Text = "HI";
grpElement1.Items.Add(lbl);

I would really just like to add labels to the content panel since my theme has it looking nice... Can someone please give me a tip on how to fix this?
Thanks - Kerri

9 Answers, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 24 Oct 2007, 02:37 PM
Hi Kerri,

It seems that because you have not set their location, all labels have a location of (0, 0). If you set the location the way illustrated in the code bellow all labels are shown:

Label lbl1 = new Label(); 
lbl1.Text = "Label1"
lbl1.Location = new Point(0, 0);            this.radPanelBarGroupElement5.ContentPanel.Controls.Add(lbl1); 
 
Label lbl2 = new Label(); 
lbl2.Text = "Label2"
lbl2.Location = new Point(0, 25); 
this.radPanelBarGroupElement5.ContentPanel.Controls.Add(lbl2); 
 
Label lbl3 = new Label(); 
lbl3.Text = "Label3"
lbl3.Location = new Point(0, 50);           this.radPanelBarGroupElement5.ContentPanel.Controls.Add(lbl3); 


Thank you for writing. Do not hesitate to contact us if you need any further assistance.

Greetings,
Jordan
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kerri
Top achievements
Rank 1
answered on 24 Oct 2007, 04:29 PM
Yep fixed it.  Thanks.
0
Tim
Top achievements
Rank 1
answered on 07 May 2009, 06:09 PM

I want to add RadlabelElements directly to the PanelBarGroupElement as in Kerri's example:

RadLabelElement lbl = new RadLabelElement();
lbl.Text = "HI";
grpElement1.Items.Add(lbl);

How can I do that without the pushing the content panel south behaviour?

Thanks - Tim.

 

0
Boyko Markov
Telerik team
answered on 11 May 2009, 11:46 AM
Hello Tim,

You should use the ContentPanel only when you add Controls and whenever the groupElement EnableHostControlMode property value is true, otherwise you should use the Items collection of RadPanelBarGroupElement to directly add any items such as RadLabelElements.

Here is sample code demonstrating how to add a label element to RadPanelBarGroupElement

   RadLabelElement label = new RadLabelElement();
            label.Text = "test";
            this.radPanelBarGroupElement1.Items.Add(label);

I hope this helps. Do not hesitate to write me back if you have further questions.

All the best,
Boyko Markov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Tim
Top achievements
Rank 1
answered on 11 May 2009, 12:57 PM
Thanks, that did it.
0
YING JANG LIN
Top achievements
Rank 1
answered on 09 Apr 2010, 03:16 AM
Hi,

In Tim's example.

1,I have 3 group item . each item have 3 or 5 label , I hope can catch which label of group had clicked.

group 1
-----------
 g1label1
 g1label2

group 2
 ----------
 g2label1
 g2label2
 g2label3

2, How set space for item at group?
group 1
---------
<space2 > g1label1
 <space 2> g1label1
group 2
---------
<space3> g2label2
            .
            .
            .

3,How to set nest group item?
    Gorup 1
    ----------
   <space 3> subgroup 1
        ------------------------
           <space 5> g1 sub1 label1
           <space 5> g1 sub1 label2
   <space 3> subgroup 2
          <space 5> g1 sub2 label1
           <space 5> g1 sub2 label2
Gorup 2
----------
   <space 3> subgroup 1
        ------------------------
           <space 5> g2 sub1 label1
           <space 5> g2 sub1 label2
   <space 3> subgroup 2
          <space 5> g2 sub2 label1
           <space 5> g2 sub2 label2

Hope can help me and code in VB.net

Thanks

0
Vassil Petev
Telerik team
answered on 16 Apr 2010, 09:46 AM
Hi YING JANG LIN,

Please, check the panelbar documentation on how to work with the control.


All the best,
Vassil
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
YING JANG LIN
Top achievements
Rank 1
answered on 21 Apr 2010, 02:51 PM
Hello,Vassil


I have attahed sample file and programming.
.
1, I have found document without set sub group size and location and sub group item fit group size 

2, How to separate set group font size,sub group font size and sub group item font size


Thanks

YJ  
0
Nikolay
Telerik team
answered on 27 Apr 2010, 07:06 AM
Hi YING JANG LIN,

Please note that you are only allowed to attach images to the forum messages. This may be the reason why I cannot notice any attachments to your latest response.

1. Please refer to our Examples application, section PanelBar >> Nested PanelBars. This examples demonstrates how to nest RadPanelBars into each other.
2. In order to set the font of a group, let's say RadPanelBarGroupElement1, please consider the following code snippet:
RadPanelBarVisualElement captionElement = this.radPanelBarGroupElement1.GetCaptionElement();
captionElement.Font = new Font("Comic Sans Serif", 12, FontStyle.Strikeout);

As to the font of the group items, assuming that your items are contained in RadPanelBarGroupElement1, follow the approach demonstrated below:
Font font = new Font("Comic Sans Serif", 12, FontStyle.Strikeout);
for (int i = 0; i < this.radPanelBarGroupElement1.Items.Count; i++)
{
     this.radPanelBarGroupElement1.Items[i].Font = font;
}


Sincerely yours,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Panelbar (obsolete as of Q2 2010)
Asked by
Kerri
Top achievements
Rank 1
Answers by
Jordan
Telerik team
Kerri
Top achievements
Rank 1
Tim
Top achievements
Rank 1
Boyko Markov
Telerik team
YING JANG LIN
Top achievements
Rank 1
Vassil Petev
Telerik team
Nikolay
Telerik team
Share this question
or