Please Help with Code Behind

  •  12-04-2005, 2:43 PM

    Please Help with Code Behind

    I have found several examples using the html and the following method to display the editor and they work fine just not for what Im doing. The method that functioned used:

    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <CE:Editor id="Editor1" runat="server" ></CE:Editor>


    I am using Visual Studio .Net 2003.
     
    I have a webform named WebForm1; this was generated using the default asp application.
     
    I have added the control to my toolbar and a reference to the dll in my project references.
     
    I am now in the code behind the form
     
    This is what my code looks like:




    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      'Put user code to     initialize the page here
      Response.Write("Text Before Editor<br>")
      ShowAnEditor()
      Response.Write("<br>Text After Editor")
    End Sub

    Private Sub ShowAnEditor()
      Dim Editor As New CuteEditor.Editor
      Editor.Text = "This is a test"
      Dim sb As New System.Text.StringBuilder
      Dim sw As New System.IO.StringWriter(sb)
      Dim htw As New System.Web.UI.HtmlTextWriter(sw)
      Editor.RenderControl(htw)
      Response.Write(sb.ToString)

    End Sub


    The "ShowAnEditor" function fails with a null reference error. please assist. Remember I'm looking to place an editor with the call to a routine dynamically.



View Complete Thread