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 7192575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:58:08+00:00 2026-05-28T19:58:08+00:00

How do I add a user control on page load dynamically in ASP.NET? I

  • 0

How do I add a user control on page load dynamically in ASP.NET?

I have a div with ID="contentData" and few controls

  • one.ascx
  • two.ascx
  • three.ascx

Now I have created a page default.aspx, which may get parameters in query string, in one of the following ways:

default.aspx?val=one  
default.aspx?val=two  
default.aspx?val=three

I am taking the value from

Request.QueryString["val"]

Now how do I load specific control in this?

<div ID="controlData"></div>
  • 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-28T19:58:09+00:00Added an answer on May 28, 2026 at 7:58 pm

    In your aspx

    <div id="div1" runat="server">
    
    </div>
    

    In Page_Load

        UserControl uc = (UserControl)Page.LoadControl("test.ascx");
        div1.Controls.Add(uc);
    

    All you need to do is make your div server bound by adding runat=”server”, and in the codebehind use Page.LoadControl to go out and fetch your usercontrol and then add it to your div using the div’s Controls.Add

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've a ASP.Net page (Default.aspx) which will load UserControl (ucontrol.ascx) dynamically into an UpdatePanel.
I would like to add graphing to my User Controls in ASP.NET MVC. I
Best method to add/remove webcontrols or user controls in asp.net for dynamic forms without
Working on an ASP.NET 4.0 project, which uses user controls to dynamically generate a
I have created a web user control (MemberDetails.ascx) which is loaded dynamically on a
I have a custom ASP.NET user control that is added to a panel on
I'm trying to add rows dynamically to a System.Web.UI.WebControls.Table control in ASP.NET. I found
I have a ASP.NET GridView that uses template columns and user controls to allow
I have a asp.net web page with place holder control and Menu control when
I have a page on which I must load controls dynamically based on the

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.