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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:56:02+00:00 2026-05-13T14:56:02+00:00

I have a custom DDL that lives in my Server control library. Currently I

  • 0

I have a custom DDL that lives in my Server control library.

Currently I add this control to a table by strongly typing the name of the control, the customary way.

Control_Library.Report_NumberDDL newDDL = new Control_Library.Report_NumberDDL();

What I want to be able to do is dynamically create that control by pulling the control name from a table.

So I would have the name of the control in my code, in this case “Report_NumberDDL”, and I would like to then create the control without having to strongly type it.

Something like this, though I know this doesn’t work:

string controlName = "Report_NumberDDL";

Control_Library."controlName" controlNum1 = new Control_Library."controlName"();

SO since that obviously doesn’t work can somebody help me with what would work?

Thanks

Edit:

I tried to do this:

    Type type = Type.GetType("Control_Library.Report_NumberDDL");
    object control = Activator.CreateInstance(type);

But on the CreateInstance(type) I get a null value exception. So the Type isn’t getting created correctly.

  • 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-13T14:56:03+00:00Added an answer on May 13, 2026 at 2:56 pm

    You’ll need to use reflection to dynamically instantiate objects. Import the System.Reflection namespace, then do something like this:

    Type type = Type.GetType(ControlName); 
    object control = Activator.CreateInstance(type); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have custom classes that I currently instantiate within App.xaml as resources. I want
I have custom server control contains templatefield when an out button clicked the field
I have custom exceptions in my django project that look like this: class CustomFooError(Exception):
I have a custom control that will do some fancy stuff, once it knows
I have custom assembly that is loaded on runtime. at this point i have
We have custom cms that currently sits on a vendor's subdomain, such as cms.vendor.com.
I have a custom view I created that resides in a library I'm referencing
I have custom event that has several different subscribers who will all use the
I have custom gallery. Gallery represents items that are frame layout. There are one
I have custom component that I can place in my layout file (XML) for

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.