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

Remove RadPanelBarGroupElement from RadPanelbar at runtime

3 Answers 91 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.
Walter
Top achievements
Rank 1
Walter asked on 24 Jul 2008, 11:20 AM
Hello,

I have a radpanelbar with 10 RadPanelBarGroupElements where i want to remove some RadPanelBarGroupElements at runtime. I use this:

this.radPanelBar.Items.Remove(element); // element is a RadPanelBarGroupElement

Inside each RadPanelBarGroupElement there is a radgridview.

this shows up fine, but when the application exits, i get an argumentexception ("parameter is not valid")
the stacktrace shows this:    at System.Drawing.Drawing2D.Matrix.Clone()

if i do this instead:
element.Visibility = ElementVisibility.Hidden;
the error doesn't happen, and the element is hidden but still takes up space inside the panelbar (i don't want that).

What is the best way to remove items from a radpanelbar?
i used version 6.1.0.0

Walter

3 Answers, 1 is accepted

Sort by
0
Boyko Markov
Telerik team
answered on 24 Jul 2008, 02:51 PM
Hello Walter,

Thank you for contacting me.

I would suggest you to use the Collapsed visibility state instead of Hidden? ElementVisibility.Hidden member only hides the element but it still has bounds, which affect the control's layout while the ElementVisibility.Collapsed member hides the element and its bounds do not affect the internal control's layout.

Don't hesitate to contact me if you have further problems.

Best wishes,
Boyko Markov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Walter
Top achievements
Rank 1
answered on 25 Jul 2008, 07:21 AM
Hello Boyko,

The elementVisibility.Collapsed didn't do the trick, but this did:

for

(int i = elementlist.Count; i > list.Count; i--)

{

RadPanelBarGroupElement element = elementlist[i - 1];

RadGridView gridview = gridviewlist[i - 1];

this.radPanelBar.Items.Remove(element);

element.Dispose();

gridview.Dispose();

}

gridview is the gridview inside the contentpanel.

Grtz,


walter

0
Accepted
Boyko Markov
Telerik team
answered on 25 Jul 2008, 01:15 PM
Š¢hank you very much for the tip, Walter. I'm happy to hear that everything is fine now. Indeed, your approach seems better than mine.

If you have any further questions please write us.
 

Greetings,
Boyko Markov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Panelbar (obsolete as of Q2 2010)
Asked by
Walter
Top achievements
Rank 1
Answers by
Boyko Markov
Telerik team
Walter
Top achievements
Rank 1
Share this question
or