tags:

views:

49

answers:

1

(C#/SQL/Approach-question)

This has to be one of the hardest nuts I've ever had to crack. So I sincerely hope one of you smart people out there have tried to solve this before! :)

I have a much of catagories (A,B,C) with pictures.

For each picture I need to ascribe some information, based on some controls that have either no- or predefined options. For instance in catagory A I have a textbox where you can enter anything you want, and a dropdownbox where you can choose between 3 options.

Now, for each catagory I would like to be able to design (decide) which controls (text, select, checkbox, radio, etc.) I want to ascribe to a catagory, and I want also to be able to decide what values apply to that control. Let's say I have a select-control, and I want to be able to decide if multiple select are allowed, and which values are available.

So the end product would be:

  1. I can administrate what catagories have which controls in them, and which options are available (i.e. single or multiple select) as well as which values are ascribed or allowed.
  2. I need to be able to store this information in a persistable fashion.
  3. I need to be able to "easily" parse the return-data from the page where the controls are rendered.

I realize this is a complicated question, and I will be happy to answer any questions you might have to help clarify the problem.

Thank you in advance!

A: 

You could separate the render part (dynamically generated) apart from what to render(based on categories).

Assuming you will use winform controls.. you could have a config file or a simple SQL table that follows schema below:

Table_Category (CategoryName, nickNameOfControl, NotNull, OtherAttributes)

Table_Control (nickNameOfControl, ControlType, Values)

Based on your actual table design, you will be able to CRUD on the tables design time for administration, your render part of the program can read the ControlType information (TextBox, ComboBox etc) and dynamically generate the controls at run time.

Hope this helps.

47d_
It's not winforms controls, it's tagged ASP.net
recursive
Doesnt matter. As long as you handle proper rendering of controls during initial load and during postback it is possible to extract the category and controls structure from config/sql and render them correctly.
47d_