Dynamic Controls in ASP.NET Web Form
Posted on 2005-04-26
I am working on an ASP .NET application to manage the creation of questionnaires. Questionnaires are composed of a number of Questions in a specified order. Questions can be of type bool, select, int, string, decimal etc. (note that these "types" are simply names used to decribe different types of questions rather than actual C# data types).
Depending on the question type, a different control needs to be displayed accordingly i.e. a checkbox for bool type, a text field for string type or a dropdown list or the select type. My question is how best to go about achieving this in a ASP .NET Web Form? The controls will also need data to be bound (i.e. the dropdownlist would display a list of possible answers). I would ideally like to keep the code in the code behind if possible rather than mess around with the HTML bit.
Any help much appreciated!