Creation of custom control using the Two rad Editors

2 posts, 0 answers
  1. Ragupathi
    Ragupathi avatar
    41 posts
    Member since:
    Jul 2008

    Posted 05 Sep 2008 Link to this post

      hi,
     I have created a custom control using two radeditors and a spliiter in the middle . I want to render the control into in the design mode . I am not able to get the complete control when i drag and drop. it sis visisble in the Run time in the aspx. But i want the control tioo be rendered in the design time itself.



    note: i am able to obtain other controls when rendering .. except the  radeditor and splitter..

    please help me in this process.






    here the code which i have send as HTML:
      <telerik:RadSplitter id="Radsplitter3" runat="server" height="300" width="700" Orientation="Horizontal">
                    <telerik:RadPane id="Radpane4" runat="server">
                        Splitt<telerik:RadEditor ID="RadEditor1" Runat="server">
                        </telerik:RadEditor>
                      Top Pane
                    </telerik:RadPane>
                    <telerik:RadSplitBar id="Radsplitbar4" runat="server" CollapseMode="Forward"/>
                    <telerik:RadPane id="Radpane5" runat="server">
                        Splitter Bottom<telerik:RadEditor ID="RadEditor2" Runat="server">
                        </telerik:RadEditor>
                     </telerik:RadPane>
                </telerik:RadSplitter>


    Find the code which i used to render the telerik controls.   


       

        #region CreateChildControls
            protected override void CreateChildControls()
            {
                try
                {
                    //// Creation of the Controls
                    radPaneTop.Controls.Add(radEditorTop);
                    radPaneBottom.Controls.Add(radEditorBottom);
                    radSplit.Controls.Add(radPaneTop);
                    radSplit.Controls.Add(radSplitBar);
                    radSplit.Controls.Add(radPaneBottom);
                   
                    this.Controls.Add(radSplit);
                    base.CreateChildControls();
                }
                catch (Exception ExpCreateChildControls)
                {
                    throw ExpCreateChildControls;
                }
            }

            #region EnsureChildControls
            protected override void EnsureChildControls()
            {
                base.EnsureChildControls();
            }
            #endregion
            #endregion

            protected override void Render(HtmlTextWriter writer)
            {
                try
                {
                    // AddAttributesToRender(writer);
                    if (HttpContext.Current != null)
                    {
                        //Panel a = new Panel();
                        //TextBox b = new TextBox();
                        //a.RenderBeginTag(writer);                  

                        this.radSplit.RenderBeginTag(writer);
                        this.radPaneTop.RenderBeginTag(writer);
                        //this.radEditorTop.RenderControl(writer);                                       
                        this.radEditorTop.RenderControl(writer);
                        this.radPaneTop.RenderEndTag(writer);
                        this.radSplitBar.RenderBeginTag(writer);
                        this.radSplitBar.RenderEndTag(writer);
                        this.radPaneBottom.RenderBeginTag(writer);
                        this.radEditorBottom.RenderControl(writer);
                        this.radPaneBottom.RenderEndTag(writer);
                        this.radSplit.RenderEndTag(writer);
                    }
                }
                catch (Exception ex)
                {

                }

     




  2. Rumen
    Admin
    Rumen avatar
    14071 posts

    Posted 09 Sep 2008 Link to this post

    Hi Ragupathi,

    The reason for the problem is your code that overrides the CreateChildControls and Render methods. Our suggestion is to not execute this code when switching to Design mode of Visual Studio by wrapping the code inside the following if statement:

    if (!this.DesignMode)
    {
        //custom code
    }

    Best regards,
    Rumen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top