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

Creation of custom control using the Two rad Editors

1 Answer 44 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Ragupathi
Top achievements
Rank 1
Ragupathi asked on 05 Sep 2008, 05:49 AM
  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)
            {

            }

 




1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 09 Sep 2008, 11:06 AM
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.
Tags
Dock
Asked by
Ragupathi
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or