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

Custom splitter control

2 Answers 37 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
Beth Krawczuk
Top achievements
Rank 1
Beth Krawczuk asked on 06 Mar 2008, 12:42 AM
Hi,
I'm trying to wrap the splitter control in a custom control.  Here's what I have so far, which doesn't error out but it doesn't paint a complete control.  It's seems to render the left "sliding zone" but not the insides.  Then it renders the right side correctly.

Any suggestions as to what I'm doing wrong?  Thanks, in advance, for your help.  You guys are always so helpful.
Beth

[DefaultProperty("Text")]  
    [ToolboxData("<{0}:MySplitter runat=server></{0}:MySplitter>")]  
    public class MySplitter : WebControl, INamingContainer  
    {  
        private RadSplitter mainSplitter;  
        private RadPane leftPane;  
        private RadSlidingZone  leftPaneSlidingZone;  
        private RadSlidingPane  leftPaneSlidingPane;  
        private RadPane rightPane;  
        private RadSplitBar splitBar;  
 
        protected override void CreateChildControls()  
        {  
            // ----------- create the splitter control  
            mainSplitter = new RadSplitter();  
            mainSplitter.EnableEmbeddedSkins = false;  
            mainSplitter.EnableTheming = true;  
              
            // ----------- create the panes and splitbars  
            leftPane = new RadPane();  
            leftPaneSlidingZone = new RadSlidingZone();  
            leftPaneSlidingPane = new RadSlidingPane();  
            rightPane = new RadPane();  
            splitBar = new RadSplitBar();  
 
 
            leftPane.Controls.Clear();  
 
            leftPaneSlidingPane.ID = "lftSlidingPane";  
            leftPaneSlidingPane.Title = "test";  
 
            // add content to leftPaneSlidingPane  
            Label label1 = new Label();  
            label1.Text = "Content of Left Pane";  
            leftPaneSlidingPane.Controls.Add(label1);  
 
            // Place sliding pane inside sliding zone  
            leftPaneSlidingZone.ID = "lftPaneSlidingZone";  
            leftPaneSlidingZone.Controls.Add(leftPaneSlidingPane);  
 
            // Place sliding zone inside the left pane  
            leftPane.Controls.Add(leftPaneSlidingZone);  
 
            rightPane.Controls.Clear();  
            // add content to right pane  
            Label label2 = new Label();  
            label1.Text = "Content of right Pane";  
            rightPane.Controls.Add(label1);  
 
            mainSplitter.Items.Add(leftPane);  
            mainSplitter.Items.Add(splitBar);  
            mainSplitter.Items.Add(rightPane);  
 
            Controls.Add(mainSplitter);  
        } 

2 Answers, 1 is accepted

Sort by
0
Accepted
Svetlina Anati
Telerik team
answered on 10 Mar 2008, 03:36 PM
Hello Beth,

I already answered your other thread - for your convenience I am placing my answer below:

The Controls collection is inherited from the Control class. The RadSplitter control is a complex control and its child controls are also third part user controls and according to some good practices it's comfortable to use another alternative collection for them. Considering the RadSlidingZone this collection is its Items collection. This being said, you should add the RadSlidingPanes in the Items collection as shown below:

   leftPaneSlidingZone.Items.Add(leftPaneSlidingPane); 
   
We apologize for the inconvenience and we logged this in our TODO list - we will write additional code in order to make this controls available in the Controls collection too.

Your points were updated.



Best wishes,
Svetlina
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Beth Krawczuk
Top achievements
Rank 1
answered on 12 Mar 2008, 06:30 PM
Sorry this got posted twice,
Thanks again for the fix!
Beth
Tags
Splitter
Asked by
Beth Krawczuk
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Beth Krawczuk
Top achievements
Rank 1
Share this question
or