Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 0.52 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. how can i set atributes to @Html.DropDownList
  2. table sample
  3. {
  4. id,
  5. studentid,
  6. courseid,
  7. grade,
  8. studentTeacher
  9. }
  10.        
  11. ViewBag.Student= new SelectList(db.Course.Where(c => c.StudentId== id), "StudentId","FullName");
  12. ViewBag.CourseId = new SelectList(db.Course, "CourseId ", "Name");
  13. ViewBag.StudentId = new SelectList(db.Student, "StudentId","FullName");
  14.        
  15. @Html.DropDownList("Student")
  16.  @Html.DropDownList("CourseId ")
  17.  @Html.DropDownList("StudentId ", string.Empty)
  18.        
  19. @Html.DropDownList("Student", ViewBag.Student)
  20. // etc.