How to use RenderControl correctly

  •  06-14-2009, 3:28 AM

    How to use RenderControl correctly

    Hi,
     
    I'm finishing the design of a DLL that will make use of a Html Editor and am currently evaluating CuteEditor (our first choice).
     
    I came into a problem that maybe somenone can easily help me. I have to create the CuteEditor Html Editor fields without any "code behind HTML", in other words, I cannot use the <CE:Editor> tag because they will all be compiled inside a .NET DLL class. As with any commom ASP.NET component, I tried the "classic" .NET procedure, as exemplified in the function below: 

    Function HtmlField() As String

    'Creates and configures the CUTEDITOR object
    Dim Editor1 As CuteEditor.Editor = New CuteEditor.Editor()
    Editor1.ID = "id_here"
    Editor1.Text = "Test Text"
    Editor1.ThemeType = CuteEditor.ThemeType.Office2007
    Editor1.AutoConfigure = CuteEditor.AutoConfigure.Simple
    Editor1.DisableItemList = "save"
    Editor1.EnableClientScript = True
    Editor1.EnableViewState = False

    'Render Output HTML using "classic" .NET architecture
    Dim sb As StringBuilder = New StringBuilder()
    Dim s As New System.IO.StringWriter(sb)
    Dim w As New System.Web.UI.HtmlTextWriter(s)
    Editor1.RenderControl(w)

    'Return HTML string of component
    Return sb.ToString()

    End Function

    In all tests I performed, the code above return only the "textbox" version of the CuteEditor, without any buttons or JS calls:
     
    Html output from function above:
     
    <!-- CuteEditor id_here Begin -->
    <textarea cols="50" rows="14" name="id_here" style="width:780px;height:320px;">Test Text </textarea>
    <!-- CuteEditor id_here End c0 ms0-->
     
    My question is, what am I doing wrong? Am I forgeting to set any specific Editor1 parameter before calling its RenderControl function? I really don't believe that CuteEditor is not compatible with this procedure because of its classical ASP version (that does exactly this), so I think I am missing something. Could someone, please, point me out at what it is?
     
    Thank you very much!
    Filed under: ,
View Complete Thread