How can I hide or show User Controls
Posted on 2004-10-18
ok, I'm a new asp.net programmer. I have created an webform which will become a Order Entry screen. Basicly I have 10 questions to ask the user in order to get the correct Item selected. Currently I have 10 User Controls with each one containing one of the 10 questions. Most user controls contain a table and within that table either a drop down list, buttons or datagrids.
Here is what I need help with. Sometimes all 10 question don't have to be answered. Depending on their selectons (as an example) for the frist question, might make question #8 irrelevant. So in that case I would want to hide Question #8. No need to show the user a question they don't have to answer. So I want to turn that question invisible based on the answer of question #1. I currently load all 10 user controls in on the page Init of the main form. So how can I turn these user controls on and off as the fill out the form? Also there is no specific reason why I put the questions in user controls. If there is some other way to show and hide questions that is better, please let me know.
And remember I am a new program, so any syntax you can provide or sample code would be greatly appreciated!!!
Thanks for your help!