Using CuteEditor in codebehind

  •  11-25-2004, 6:00 PM

    Using CuteEditor in codebehind

    Im writing all my code in the codebehind file.

    publicclass Default : Page

    {

      protectedoverridevoid OnInit(EventArgs e)

      {

        base.OnInit (e);

        HtmlForm MyForm = new HtmlForm();

        MyForm.ID = "Form1";

        Controls.Add( MyForm );


        CuteEditor.Editor Editor1 = new CuteEditor.Editor();

        Editor1.ID = "Editor1";

        MyForm.Controls.Add( Editor1 );

      }

    }
    But somehow its not working, i get the following error. anyone know how to fix this ?

    Server Error in '/Area51' Application.
    --------------------------------------------------------------------------------

    Object reference not set to an instance of an object.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

    Stack Trace:

    [NullReferenceException: Object reference not set to an instance of an object.]
       CuteEditor.a.g(HtmlTextWriter A_0) +9
       CuteEditor.a.i(HtmlTextWriter A_0) +57
       CuteEditor.Editor.Render(HtmlTextWriter writer) +43
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
       System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer)
       System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer)
       System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output)
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
       System.Web.UI.Control.Render(HtmlTextWriter writer)
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
       System.Web.UI.Page.ProcessRequestMain()

     


    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032

     

View Complete Thread