Re: RenderControl throws an error

  •  01-10-2005, 4:08 PM

    Re: RenderControl throws an error

    Hi Adam

    Thanks for your reply

    The thing is I don't want to use <CE:Editor id="Editor1" runat="server" ></CE:Editor> in my code. When  <CE:Editor..... /> is used I need to use <script runat="server"> and the Page_Load(object sender, System.EventArgs e) method or code-behind. This is something that I don't want to do(actually can't do it for a specific boring reason that I don't want get into ).

    Try running this example code on an aspx page
    <%@ Page Language="C#" %>

    <%@ Import namespace="System.IO" %>

    <%
        System.Web.UI.WebControls.Button b = new System.Web.UI.WebControls.Button();
        b.Text = "hello";

        StringBuilder sb    = new StringBuilder();
        StringWriter sw        = new StringWriter(sb);
        HtmlTextWriter htw  = new HtmlTextWriter(sw);

        b.RenderControl(htw);
        Response.Write(sb.ToString());
    %>

    As you can see the result is <input type="submit" name value="hello" /> from that code. That is what I would like from CuteEditor when I call RenderControl. In theory this should work as you can see with the Button WebControl (or any other WebControl that you would try, even non-Microsoft).

    It's like I need initiate some variable sine an "Object reference not set to an instance of an object" exception is thrown.

    Hope you can give me some tip on this

    ingig


View Complete Thread