Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 849381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:05:52+00:00 2026-05-15T07:05:52+00:00

How do I go about rendering an asp.net control on a web page from

  • 0

How do I go about rendering an asp.net control on a web page from a string in code behind?

For example, say I have the aspx page below:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="nrm.FRGPproposal.Questionnaire1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        //want to render a text box here
    </div>
    </form>
</body>
</html>

What could I do in my Page_Load event to render a TextBox into the div?

protected void Page_Load(object sender, EventArgs e)
{
    //what do i do here to render a TextBox in the div from the aspx page?
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T07:05:52+00:00Added an answer on May 15, 2026 at 7:05 am

    Caution there may be compilation problems here. But basically add a placeholder control to the code in front as such.
    <%@ Page Language=”C#” AutoEventWireup=”true” CodeBehind=”Default.aspx.cs” Inherits=”nrm.FRGPproposal.Questionnaire1″ %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:placeholder id="placeHolder" runat="server"/>
        </div>
        </form>
    </body>
    </html>
    

    Then create a TextBox in the code behind programmatically. You will need to include System.Web.UI in order to get the textbox.
    Then Add the control to the controls collection on the placeHolder. Set whatever properties you like on the text box programmatically

    protected void Page_Load(object sender, EventArgs e)
    {
        TextBox tb = new TextBox();
        placeHolder.Controls.Add(tb); //tb is referring to the name that you want to name your element. in this example given was TextBox. so the name of text box is tb. 
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to access the raw HTML code that my ASP.NET System.Web.UI.Page is about
I have a question about how ASP.NET AJAX partial rendering actually works. Does it:
I have an ASP.NET WebForms control (derived from Control, not WebControl, if it helps)
I have an ASP.NET page that's going to use Html controls to render a
I have an ASP.Net 2.0 page that contains two UpdatePanels. The first panel contains
I have a site written in ASP.NET MVC. I have a page where the
Any ideas about how to emulate Smooth font rendering option from Photoshop in Flash/Flex?
To gain some perspective, we've been using ASP.NET web forms for ages. We're also
Asp.net is my first incursion into web development using server side tech. The last
I am creating a website using JavaScript/ASP.NET/C#/CSS/HTML/Compact SQL server. I have the majority of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.