recuperer le value d'un DropDownList
Bonjour,
j'ai un dropdownList que je l'ai rempli par une list
code Controleur:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Dim comboPays As New List(Of SelectListItem)()
Function Edit(ByVal id As Integer) As ActionResult
For Each item As Pays In PaysDB.GetList
comboPays.Add(New SelectListItem() With {.Text = item.Nom, .Value = item.Code})
Next
Dim v = VilleManager.GetItem(id)
Dim model As New VilleViewModel
model.CodePays = v.codePays
model.CodeVille = v.CodeVille
model.Nom = v.Nom
model.Local = v.Local
model.Pays = New SelectList(comboPays, "value", "Text", v.codePays)
model.CodeNational = v.CodeNational
Return PartialView(model)
End Function |
View :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
<tr>
<td class="LabelCell"> Nom</td>
<td colspan='2'><%= Html.TextBox("Nom")%></td>
</tr>
<tr>
<td class="LabelCell">Pays</td>
<td colspan='2'><%= Html.DropDownList("pays")%></td>
</tr>
<tr>
<td class="LabelCell">Locale</td>
<td colspan='2'><%= Html.CheckBox("local")%></td>
</tr>
<tr>
<td class="LabelCell">CodeNational</td>
<td colspan='2'><%= Html.TextBox("CodeNational")%></td>
</tr> |
je veux recuperer le value de dropdownList lorsque je change la selection
Merci d'avance.