Tough question on Hiding items in DataLists, depending on user input on previous data list items.
-
I am creating a website for questionnaires. One of the needs expressed is to have questions automatically disappear or appear depending on the answers of previous questions (for example, if we ask someone if he has the X system, and he replies no, we should automatically hide questions on his experienc with the X system). Well, I thought of making some things visible or invisible with JavaScript, but 1) I don't know how to call JavaScript from asp controls Event Handlers (I know from classic Buttions, but with asp controls it seems not to work) and 2) I don't know how to access the previous and next elements of the list . To understand this, I have a simplified example below - Suppose that a Question is a Data Item with the following properties; QuestionText, QuestionType, Parent, Id (Parent is the Id of the question this question depends on - a relation to the same table).
What happens if we want the third and fourth question in the datalist have the second as a parent, and they should not show up if the second is not answered? We have to check if the TextResponse or RealResponse control for the parent question has value - I cannot think of any way to do this in client script or a declarative way - and doing this with constant postbacks to the server whenever a user replies a question is horribly slow and annoying. Any ideas? Or is it just too difficult and I should tell my supporting teacher that we should live without this functionnality? [No signature, boo? I need a bigge