Bonjour à tous.
J'ai deux model

UtilisateurModel

Code VB.NET : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
Public Class Utilisateur
    Public Property Id As Integer
    Public Property DirectionId As Integer
    Public Property Departement As String
End Class

DirectionModel

Code VB.NET : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
Public Class Direction
    Public Property Id As Integer
    Public Property Valeur As String
    Public Property Supprime As Boolean
End Class

et ma vue

CreateOrEditUtilisateurView

Code CSHTML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
@ModelType ANNUAIRE.Utilisateur
@Code
    ViewData("Title") = "Create or Edit"
    Layout = "~/Views/Shared/_Layout.vbhtml"
End Code
 
<h2>Create Or Edit</h2>
 
@Using (Html.BeginForm()) 
    @Html.AntiForgeryToken()
 
    @<div Class="form-horizontal">
        <h4>Utilisateur</h4>
        <hr />
        @Html.ValidationSummary(True, "", New With {.class = "text-danger"})
        @Html.HiddenFor(Function(model) model.Id)
 
        <div class="form-group">
            @Html.LabelFor(Function(model) model.DirectionId, htmlAttributes:= New With { .class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(Function(model) model.DirectionId, New With {.htmlAttributes = New With {.class = "form-control"}})
                @Html.ValidationMessageFor(Function(model) model.DirectionId, "", New With {.class = "text-danger"})
            </div>
        </div>
 
        <div class="form-group">
            @Html.LabelFor(Function(model) model.Departement, htmlAttributes:=New With {.class = "control-label col-md-2"})
            <div class="col-md-10">
                @Html.EditorFor(Function(model) model.Departement, New With {.htmlAttributes = New With {.class = "form-control"}})
                @Html.ValidationMessageFor(Function(model) model.Departement, "", New With { .class = "text-danger" })
            </div>
        </div>
   </div>
End Using

Je voudrais remplacer le textbox de "DirectionId" par un dropdownlist rempli à partir du modèle "Direction"
Toutes mes recherches sont infructueuses.
Si quelqu'un a une solution ou un lien, je lui serai reconnaissant