title: How to change form after it was generated by entity framework
body: <p>Please don't argue me too hard, I'm just a beginner in asp.net</p>
  
  <p>I have made controllers/views based on this model <a href="http://tinypic.com/view.php?pic=awq14w&amp;s=8#.VG2Q4PmUdUV" rel="nofollow">http://tinypic.com/view.php?pic=awq14w&amp;s=8#.VG2Q4PmUdUV</a></p>
  
  <p>When I create a new Survey I have this view <a href="http://tinypic.com/view.php?pic=33ayubs&amp;s=8#.VG2R6fmUdUV" rel="nofollow">http://tinypic.com/view.php?pic=33ayubs&amp;s=8#.VG2R6fmUdUV</a></p>
  
  <p>How can I modify the view in order to get this form type when I create/view/edit: </p>
  
  <pre><code>Questions | Answers | Comments
  ------------------------------
  Q1        | TextBox | TextBox
  Q2        | TextBox | TextBox
  Q3        | TextBox | TextBox
  </code></pre>
  
  <p>Controller :</p>
  
  <pre><code>    public class SurveysController : Controller
      {
          private OrganizationASEMEntities1 db = new OrganizationASEMEntities1();
  
          // GET: Surveys
          public ActionResult Index()
          {
              var surveys = db.Surveys.Include(s =&gt; s.Question).Include(s =&gt; s.User);
              return View(surveys.ToList());
          }
  
          // GET: Surveys/Details/5
          public ActionResult Details(int? id)
          {
              if (id == null)
              {
                  return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
              }
              Survey survey = db.Surveys.Find(id);
              if (survey == null)
              {
                  return HttpNotFound();
              }
              return View(survey);
          }
  
          // GET: Surveys/Create
              public ActionResult Create()
              {
                  ViewBag.QuestionId = new SelectList(db.Questions, "QuestionId", "QuestionText");
                  ViewBag.UserId = new SelectList(db.Users, "UserId", "Name");
                  return View();
              }
  
              // POST: Surveys/Create
              // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
              // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
              [HttpPost]
              [ValidateAntiForgeryToken]
              public ActionResult Create([Bind(Include = "SurveyId,UserId,QuestionId,Answer,Comment")] Survey survey)
              {
                  if (ModelState.IsValid)
                  {
                      db.Surveys.Add(survey);
                      db.SaveChanges();
                      return RedirectToAction("Index");
                  }
  
                  ViewBag.QuestionId = new SelectList(db.Questions, "QuestionId", "QuestionText", survey.QuestionId);
                  ViewBag.UserId = new SelectList(db.Users, "UserId", "Name", survey.UserId);
                  return View(survey);
              }
  
              // GET: Surveys/Edit/5
              public ActionResult Edit(int? id)
              {
                  if (id == null)
                  {
                      return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
                  }
                  Survey survey = db.Surveys.Find(id);
                  if (survey == null)
                  {
                      return HttpNotFound();
                  }
                  ViewBag.QuestionId = new SelectList(db.Questions, "QuestionId", "QuestionText", survey.QuestionId);
                  ViewBag.UserId = new SelectList(db.Users, "UserId", "Name", survey.UserId);
                  return View(survey);
              }
  
              // POST: Surveys/Edit/5
              // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
              // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
              [HttpPost]
              [ValidateAntiForgeryToken]
              public ActionResult Edit([Bind(Include = "SurveyId,UserId,QuestionId,Answer,Comment")] Survey survey)
              {
                  if (ModelState.IsValid)
                  {
                      db.Entry(survey).State = EntityState.Modified;
                      db.SaveChanges();
                      return RedirectToAction("Index");
                  }
                  ViewBag.QuestionId = new SelectList(db.Questions, "QuestionId", "QuestionText", survey.QuestionId);
                  ViewBag.UserId = new SelectList(db.Users, "UserId", "Name", survey.UserId);
                  return View(survey);
              }
  
              // GET: Surveys/Delete/5
              public ActionResult Delete(int? id)
              {
                  if (id == null)
                  {
                      return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
                  }
                  Survey survey = db.Surveys.Find(id);
                  if (survey == null)
                  {
                      return HttpNotFound();
                  }
                  return View(survey);
              }
  
              // POST: Surveys/Delete/5
              [HttpPost, ActionName("Delete")]
              [ValidateAntiForgeryToken]
              public ActionResult DeleteConfirmed(int id)
              {
                  Survey survey = db.Surveys.Find(id);
                  db.Surveys.Remove(survey);
                  db.SaveChanges();
                  return RedirectToAction("Index");
              }
  
              protected override void Dispose(bool disposing)
              {
                  if (disposing)
                  {
                      db.Dispose();
                  }
                  base.Dispose(disposing);
              }
          }
      }
  </code></pre>
  
  <p>View <code>Create</code>:</p>
  
  <pre><code>    @model OrganizationASEM.Models.Survey
  
      @{
          ViewBag.Title = "Create";
      }
  
      &lt;h2&gt;Create&lt;/h2&gt;
  
      @using (Html.BeginForm()) 
      {
          @Html.AntiForgeryToken()
  
          &lt;div class="form-horizontal"&gt;
              &lt;h4&gt;Survey&lt;/h4&gt;
              &lt;hr /&gt;
              @Html.ValidationSummary(true, "", new { @class = "text-danger" })
              &lt;div class="form-group"&gt;
                  @Html.LabelFor(model =&gt; model.UserId, "UserId", htmlAttributes: new { @class = "control-label col-md-2" })
                  &lt;div class="col-md-10"&gt;
                      @Html.DropDownList("UserId", null, htmlAttributes: new { @class = "form-control" })
                      @Html.ValidationMessageFor(model =&gt; model.UserId, "", new { @class = "text-danger" })
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;div class="form-group"&gt;
                  @Html.LabelFor(model =&gt; model.QuestionId, "QuestionId", htmlAttributes: new { @class = "control-label col-md-2" })
                  &lt;div class="col-md-10"&gt;
                      @Html.DropDownList("QuestionId", null, htmlAttributes: new { @class = "form-control" })
                      @Html.ValidationMessageFor(model =&gt; model.QuestionId, "", new { @class = "text-danger" })
                  &lt;/div&gt;
              &lt;/div&gt;
          enter code here
              &lt;div class="form-group"&gt;
                  @Html.LabelFor(model =&gt; model.Answer, htmlAttributes: new { @class = "control-label col-md-2" })
                  &lt;div class="col-md-10"&gt;
                      @Html.EditorFor(model =&gt; model.Answer, new { htmlAttributes = new { @class = "form-control" } })
                      @Html.ValidationMessageFor(model =&gt; model.Answer, "", new { @class = "text-danger" })
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;div class="form-group"&gt;
                  @Html.LabelFor(model =&gt; model.Comment, htmlAttributes: new { @class = "control-label col-md-2" })
                  &lt;div class="col-md-10"&gt;
                      @Html.EditorFor(model =&gt; model.Comment, new { htmlAttributes = new { @class = "form-control" } })
                      @Html.ValidationMessageFor(model =&gt; model.Comment, "", new { @class = "text-danger" })
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;div class="form-group"&gt;
                  &lt;div class="col-md-offset-2 col-md-10"&gt;
                      &lt;input type="submit" value="Create" class="btn btn-default" /&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      }
  
      &lt;div&gt;
          @Html.ActionLink("Back to List", "Index")
      &lt;/div&gt;
  </code></pre>
  
  <p>View <code>Edit</code>:</p>
  
  <pre><code>@model OrganizationASEM.Models.Survey
  
  @{
      ViewBag.Title = "Edit";
  }
  
  &lt;h2&gt;Edit&lt;/h2&gt;
  
  @using (Html.BeginForm())
  {
      @Html.AntiForgeryToken()
  
      &lt;div class="form-horizontal"&gt;
          &lt;h4&gt;Survey&lt;/h4&gt;
          &lt;hr /&gt;
          @Html.ValidationSummary(true, "", new { @class = "text-danger" })
          @Html.HiddenFor(model =&gt; model.SurveyId)
  
          &lt;div class="form-group"&gt;
              @Html.LabelFor(model =&gt; model.UserId, "UserId", htmlAttributes: new { @class = "control-label col-md-2" })
              &lt;div class="col-md-10"&gt;
                  @Html.DropDownList("UserId", null, htmlAttributes: new { @class = "form-control" })
                  @Html.ValidationMessageFor(model =&gt; model.UserId, "", new { @class = "text-danger" })
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              @Html.LabelFor(model =&gt; model.QuestionId, "QuestionId", htmlAttributes: new { @class = "control-label col-md-2" })
              &lt;div class="col-md-10"&gt;
                  @Html.DropDownList("QuestionId", null, htmlAttributes: new { @class = "form-control" })
                  @Html.ValidationMessageFor(model =&gt; model.QuestionId, "", new { @class = "text-danger" })
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              @Html.LabelFor(model =&gt; model.Answer, htmlAttributes: new { @class = "control-label col-md-2" })
              &lt;div class="col-md-10"&gt;
                  @Html.EditorFor(model =&gt; model.Answer, new { htmlAttributes = new { @class = "form-control" } })
                  @Html.ValidationMessageFor(model =&gt; model.Answer, "", new { @class = "text-danger" })
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              @Html.LabelFor(model =&gt; model.Comment, htmlAttributes: new { @class = "control-label col-md-2" })
              &lt;div class="col-md-10"&gt;
                  @Html.EditorFor(model =&gt; model.Comment, new { htmlAttributes = new { @class = "form-control" } })
                  @Html.ValidationMessageFor(model =&gt; model.Comment, "", new { @class = "text-danger" })
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              &lt;div class="col-md-offset-2 col-md-10"&gt;
                  &lt;input type="submit" value="Save" class="btn btn-default" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  }
  
  &lt;div&gt;
      @Html.ActionLink("Back to List", "Index")
  &lt;/div&gt;
  </code></pre>
  
  <p>View <code>Index</code>:</p>
  
  <pre><code>@model IEnumerable&lt;OrganizationASEM.Models.Survey&gt;
  
  @{
      ViewBag.Title = "Index";
  }
  
  &lt;h2&gt;Index&lt;/h2&gt;
  
  &lt;p&gt;
      @Html.ActionLink("Create New", "Create")
  &lt;/p&gt;
  &lt;table class="table"&gt;
      &lt;tr&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Answer)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Comment)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Question.QuestionText)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.User.Name)
          &lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
      &lt;/tr&gt;
  
  @foreach (var item in Model) {
      &lt;tr&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Answer)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Comment)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Question.QuestionText)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.User.Name)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.ActionLink("Edit", "Edit", new { id=item.SurveyId }) |
              @Html.ActionLink("Details", "Details", new { id=item.SurveyId }) |
              @Html.ActionLink("Delete", "Delete", new { id=item.SurveyId })
          &lt;/td&gt;
      &lt;/tr&gt;
  }
  
  &lt;/table&gt;
  </code></pre>