I have a been given a task to create GUI for something that could be used for bunch of different scenarios. And its a bit of mind teaser problem.
We have a set (sql table)of question entities in model which has a parent_id relationship to other question entity. If entity has nothing in parent_id fields.. that means its a level 1 entity in the tree. Using this field I can easily have a list of questions and arrange them in parent/child manner based on parent_ID, so I can traverse a list and for example get all that are on level 4 if I wanted to.
These entities has to be presented to user as either textbox, dropdownlist, radiobuttonlist, checkbocklist etc. Trick is if this question has control type property set to either dropDownList or radioButtonList , the selected index will then open appropriate child question with its children questions and so on. Textbox and other (static) types cant have children. And I always want to show just the current node and current node's children.
Everything has to be done on a web page with dynamic controls, either using pure code-behind with viewstate or javascript. Its my choice.
I have read a lot articles about viewstate, dynamic controls and asp.net page patters but still I haven't found something completely useful here.
So my question is does anyone know what will be the best pattern to use here?? Or if there already exists ready-baked controls which can be use to solve this GUI mess I have to create.Thanks..