title: Dynamically adding controls in MVC4
body: <p>I am currently working on creating an MVC4 application where I want controls to be generated automatically from the database rows. </p>
  
  <p>I have the table in my database containing the questions and the control type in which it should be answered by the user. </p>
  
  <p>I am just thinking of a logic like </p>
  
  <ol>
  <li>Where I can get the database rows in a dataset and then foreach it, then checking the type of control it belongs and then  creating the control in my View.</li>
  </ol>
  
  <p>This is my Controller action:</p>
  
  <pre><code>Public ActionResult Index()
  {
      // get the rows from the table 
      foreach(Iterate the rows)
      {
          if(controllerType1)
          {
              //stmnts
          }
  
          if(controllerType2)
          {
              //stmnts
          }       
      }
      return View();
  }
  </code></pre>
  
  <p>This is just an idea of how can we build the solution. If I am going in the right way please guide me, else I am eager to know the possibilities where I can build my solution in different ways :).</p>