Custom splitter control

3 posts, 1 answers
  1. Beth Krawczuk
    Beth Krawczuk avatar
    26 posts
    Member since:
    Feb 2008

    Posted 05 Mar 2008 Link to this post

    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. Answer
    Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 10 Mar 2008 Link to this post

    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
  3. Beth Krawczuk
    Beth Krawczuk avatar
    26 posts
    Member since:
    Feb 2008

    Posted 12 Mar 2008 Link to this post

    Sorry this got posted twice,
    Thanks again for the fix!
    Beth
Back to Top