Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class StudentModel
- {
- public IEnumerable<SelectListItem> NormalStudentsList { get; set; }
- public IEnumerable<SelectListItem> StudentsNoClassList { get; set; }
- public string[] NormalSelected { get; set; }
- public string[] NoClassSelected { get; set; }
- public string Save { get; set; }
- }
- public ActionResult IndexStudents(Docent docent, int id, int klasgroepid)
- {
- var studentModel = new StudentModel
- {
- NormalStudentsList = docent.GeefStudentenNormaalList(id, klasgroepid),
- StudentsNoClassList = docent.GeefStudentenNoClassList(id, klasgroepid)
- };
- return View(studentModel);
- }
- [HttpPost, Authorize]
- public ActionResult IndexStudentsResult(StudentModel model, string add, string remove)
- {
- ModelState.Clear();
- (if! string.IsNullOrEmpty(add))
- //update database
- SaveState(model);
- return View(model);
- }
- <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ProjectenII.Models.Domain.StudentModel>"%>
- <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
- IndexStudents
- </asp:Content>
- <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
- <h2>IndexStudents</h2>
- <%using (Html.BeginForm()) { %>
- <%=Html.ListBoxFor(model => model.NormalSelected, new MultiSelectList(Model.NormalStudentsList, "StudentNummer", "Naam", Model.NormalSelected), new { size = "6" }); %>
- <input type="submit" name="add"
- id="add" value=">>" /><br />
- <%=Html.ListBoxFor(model => model.NoClassSelected, new MultiSelectList(Model.StudentsNoClassList, "StudentNummer", "Naam", Model.NoClassSelected)); %>
- <% } %>
- <%=Html.HiddenFor(model => model.Save) %>
- <input type="submit" name="apply" id="apply" value="Save!" />
- </asp:Content>
Add Comment
Please, Sign In to add comment