(MVC) MVC (2018)

<<назад Students/Index.vbhtml (Contoso University).

   1:  @ModelType PaginatedList(Of CU_VB_3.Models.Student)
   2:  @Code
   3:      ViewData("Title") = "Index"
   4:      Layout = "~/Views/Shared/_Layout.vbhtml"
   5:  End Code
   6:   
   7:  <h2>Index</h2>
   8:   
   9:  <p>
  10:      @Html.ActionLink("Create New", "Create")
  11:  </p>
  12:   
  13:  <form action="Students" name="f1" method="get">
  14:      <div class="form-actions no-color">
  15:          <p>
  16:              Find by name: <input type="text" name="SearchString" value='@ViewData("currentFilter")' />
  17:              <input type="submit" value="Search" class="btn btn-default" /> |
  18:              @Html.ActionLink("Back to Full List", "Index")
  19:          </p>
  20:      </div>
  21:  </form>
  22:   
  23:  <table class="table">
  24:      <thead>
  25:          <tr>
  26:              <th>
  27:                  @Html.ActionLink("Last Name", "Index", New With {.SortOrder = ViewData("NameSortParm")})
  28:              </th>
  29:              <th>
  30:                  FirstMidName
  31:              </th>
  32:              <th>
  33:                  @Html.ActionLink("Enrollment Date", "Index", New With {.SortOrder = ViewData("DateSortParm")})
  34:              </th>
  35:              <th></th>
  36:          </tr>
  37:      </thead>
  38:      <tbody>
  39:          @For Each item In Model
  40:              @<tr>
  41:                  <td>
  42:                      @Html.DisplayFor(Function(modelItem) item.LastName)
  43:                  </td>
  44:                  <td>
  45:                      @Html.DisplayFor(Function(modelItem) item.FirstMidName)
  46:                  </td>
  47:                  <td>
  48:                      @Html.DisplayFor(Function(modelItem) item.EnrollmentDate)
  49:                  </td>
  50:                  <td>
  51:                      @Html.ActionLink("Edit", "Edit", New With {.id = item.ID}) |
  52:                      @Html.ActionLink("Details", "Details", New With {.id = item.ID}) |
  53:                      @Html.ActionLink("Delete", "Delete", New With {.id = item.ID})
  54:                  </td>
  55:              </tr>
  56:          Next
  57:      </tbody>
  58:  </table>
  59:   
  60:   
  61:  @Code
  62:      Dim prevDisabled = If(Not Model.HasPreviousPage, "disabled", "")
  63:      Dim nextDisabled = If(Not Model.HasNextPage, "disabled", "")
  64:  End Code
  65:   
  66:   
  67:  @Html.ActionLink("Previous", "Index", New With {.SortOrder = ViewData("CurrentSort"), .Page = (Model.PageIndex - 1), .currentFilter = ViewData("CurrentFilter")}, New With {.class = "btn btn-default " & prevDisabled})
  68:  @Html.ActionLink("Next", "Index", New With {.SortOrder = ViewData("CurrentSort"), .Page = (Model.PageIndex + 1), .currentFilter = ViewData("CurrentFilter")}, New With {.class = "btn btn-default " & nextDisabled})


Comments ( )
Link to this page: //www.vb-net.com/EF-missing-FAQ/Code/Students-Index.vbhtml2.htm
< THANKS ME>