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

Ask A Question

Stats

  • Questions 177k
  • Answers 177k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer A really simple solution to bridge the two worlds would… May 12, 2026 at 3:26 pm
  • Editorial Team
    Editorial Team added an answer Looks like you need a layout. Have a look at… May 12, 2026 at 3:26 pm
  • Editorial Team
    Editorial Team added an answer Whether a stack is suited for your particular purpose or… May 12, 2026 at 3:26 pm

Related Questions

I have a URL: Shipment/Search/{searchType}/{searchValue} and a controller action: // ShipmentSearchType is an enum
I'm trying to direct a browser to a different page. If I wanted a
I would like to use jQuery.ajax to submit a form using POST without having
I've got the following nonstandard setup (VS2008, .NET 3.5 SP1): There is a main

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.