Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I am doing a web project in which i want to bind multiple question and answer with their option (like online test) and if a question have their child question then when we select any option in parent question then according to that child question is visible

please visit this link
http://postimg.org/image/98u5denyz/[^]


i want this type of structure

in this when we select "Current Smoker" then according to this two child question comes

My database structure is

http://postimg.org/image/b6p6kfk4t/[^]

http://postimg.org/image/hth6dl2fb/[^]

please help me for this and tell me that what is logic behind this ....

my database retun this table linked below how can i bind it on my front end

http://postimg.org/image/4jdat7jcd/[^]

Thanks & regards
Srishti
Posted
Updated 8-Apr-14 2:10am
v2

1 solution

There is one Column Parent _id in Question Table. I guess you can use that.

For the two questions "Do you currently use..." and "Are you exposed to...", you can update the Column Parent_id to 5, which is the Answer_Id for "Current Smoker" in Answer Table.

This way, you can relate. So, when "Current Smoker" is selected, you query to Question Table like...
SQL
SELECT Question_Id, Question FROM Questions WHERE Parent_id = 5

5 (Answer_Id) is passed from code behind while querying.

Makes sense?
 
Share this answer
 
Comments
srishti_ 8-Apr-14 7:42am    
this is not a right solution
srishti_ 8-Apr-14 8:17am    
i posted my database result table plz have a look
What to do with that? You can't bind the questions hierarchically without having a relation, you understand that?

So, if you want some questions fall under one question, then those questions should have that as a parent. With the current results, you can't say which question comes under which other question.
Tom Marvolo Riddle 8-Apr-14 7:59am    
FYI, If it is not a right solution then explain what you're looking for and get better answer from the experts.

not a right solution won't help you much

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900