Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. RenderControl doesn't work

RenderControl doesn't work

Scheduled Pinned Locked Moved ASP.NET
htmlsysadmintoolshelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Deresen
    wrote on last edited by
    #1

    Hello, I'm busy with an rich text editor inside a web page. But when I try to render the HTML (to set it as a preview in a new textbox) it gives an error:

    Control 'TextBox1' of type 'TextBox' must be placed inside a form tag with runat=server.

    You will probably say something like: place the textbox in a form with runat=server. Well, I did that. This is my code:

    <body>
    <form id="form1" runat="server">
    <div class="somecss">
    <mnt:RichTextEditor Editor="SimpleEditor" Script="First" runat="server" ID="RTE" Rows="20" Columns="75" TextMode="MultiLine" />
    </div>
    <asp:button ID="Button1" runat="server" text="To Preview" OnClick="Click" OnClientClick="myEditor.saveHTML();" />
    <br /><br />
    <asp:TextBox ID="TextBox1" runat="server" Rows="20" Columns="75" TextMode="MultiLine" />
    </form>
    </body>

        protected void Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder(RTE.Text);
            StringWriter tw = new StringWriter(sb);
            HtmlTextWriter hw = new HtmlTextWriter(tw);
            TextBox1.RenderControl(hw);
        }
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups