title: How to load different ASP.NET controls for different concrete classes that inherit from the same abstract base class
body: <p>Say you have an abstract base class <code>Task</code> which is a task a user can complete. There are two concrete Tasks: <code>SimpleTask</code> and <code>ChecklistTask</code>. What if you wanted the (ASP.NET) UI to show a different control based on which type of Task it is?</p>
  
  <p>In WPF you could use DataTemplates, but what is a nice way to do it in ASP.NET? We are trying to avoid a switch statement by the way. We have other pieces of code with long switch statement which started out small, but grew in time. That's what we're trying to avoid.</p>
  
  <p>Is there a design pattern for things like this? We can't let the <code>Task</code> classes 'know' the UI classes because they're are domain classes. Or is a switch statement the best we can do (if necessary hidden in a seperate 'factory' class)?</p>