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

  • Home
  • SEARCH
  • 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 183123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:03:37+00:00 2026-05-11T15:03:37+00:00

I would like to dynamically generate a form from a database in ASP.NET, what

  • 0

I would like to dynamically generate a form from a database in ASP.NET, what is the best approach? Are there any built in functionalities I can use?

I will have database tables to represent the panels and their names, then for each panels, it contains the different fields and their types (Combos, Textboxes, etc..).

Please advice, thank you.

Note: I have to use Telerik Ajax controls for the form generation

  • 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. 2026-05-11T15:03:37+00:00Added an answer on May 11, 2026 at 3:03 pm

    Have a look at Dynamic Data.

    I recently found out about it and it’s already saved me a lot of time.

    Update:

    Apologies – having reread the question, I don’t think this is what you were after.

    If you want to dynamically generate the form based on the records in your database, you may have to write your own engine.

    A couple of suggestions though:

    • I’d look at using reflection to load controls rather than large case statements. That way you could dynamically add different control types just by including the new assembly. You wouldn’t have to write new code.
    • Make sure you include a way to control the display order in your database. I note that you want to use a different table for each panel of controls. I’d advise against that because of the display order problem. If you have a table with a list of panels and a table with a list of data items + foreign key references to the panels, you’ll be able to order them in a predictable and controllable way on the page.

    Update: more info on reflection

    Put simply, reflection is when you find out about details of an assembly at runtime. In this case, I suggest using reflection to load a control based on the information in your database.

    So if you had a record in your database similar to the following:

    FieldName    DataType         DisplayControl                       DisplayProperty ---------------------------------------------------------------------------------- FirstName    System.String    System.Web.UI.WebControls.TextBox    Text 

    You could use some code like the following to generate the control on the page (note that it’s untested):

    // after getting the 'PageItem' database records into a 'pageItems' array foreach (PageItem p in pageItems) {     // get the type and properties     Type controlType = System.Type.GetType(p.DisplayControl)     PropertyInfo[] controlPropertiesArray = controlType.GetProperties();      // create the object     object control = Activator.CreateInstance(controlType);      // look for matching property     foreach (PropertyInfo controlProperty in controlPropertiesArray)     {         if (controlPropertiesArray.Name == p.DisplayProperty)         {             // set the Control's property             controlProperty.SetValue(control, 'data for this item', null);         }     }      // then generate the control on the page using LoadControl (sorry, lacking time to look that up) 

    There is a really good page outlining how to do this here. It looks to be pretty much what you’re after.

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

Sidebar

Related Questions

I would like to dynamically allocate memory from the machine_init function in my arm
I am dynamically adding labels to a form and I would like to set
Working on an ASP.NET 4.0 project, which uses user controls to dynamically generate a
I have a dynamically generated form that I would like to submit using Ajax.
Essentially, I have a dynamically generated local HTML form that I would like to
So I am new to ASP.NET MVC and I would like to create a
I would like to dynamically create a minimal transparent bar graph to display over
I would like to dynamically switch the video source in a streaming video application.
I would like to dynamically hide a button in one of my views depending
For debugging / performance tests I would like to dynamically add logging code to

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.