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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| Dans mon controller :
public ActionResult CorresGroupe(decimal id = 0)
{
GROUPE groupe = db.GROUPE.Find(id);
if (groupe == null)
{
return HttpNotFound();
}
ObjectResult<U_Coordonnées_Corres_Groupe_Result> Corres = db.U_Coordonnées_Corres_Groupe(groupe.DENOMINATION);
ViewBag.Corres = Corres;
var MyPays = from p in db.PAYS where p.ID_PAYS.Equals(Corres.ElementAt(10)) select p.LIBELLE_PAYS;
ViewBag.MyPays = MyPays;
return View(groupe);
}
_______________________________________________________________________________________
Dans ma vue :
<fieldset>
<legend>Correspondant</legend>
<div class="display-label">
@Html.Label("Civilité :")
@Html.TextArea((string)@ViewBag.Corres(0), (string)@ViewBag.Corres(0))
@Html.Label("Nom :")
@Html.TextArea((string)@ViewBag.Corres(1))
@Html.Label("Prénom :")
@Html.TextArea((string)@ViewBag.Corres(2))
</div>
<div class="display-label">
@Html.Label("N° :")
@Html.Label((string)@ViewBag.Corres(3))
@Html.Label("Rue :")
@Html.Label((string)@ViewBag.Corres(4))
</div>
<div class="display-label">
@Html.Label("CP :")
@Html.Label((string)@ViewBag.Corres(5))
@Html.Label("Ville :")
@Html.Label((string)@ViewBag.Corres(6))
@Html.Label("Pays :")
@Html.Label((string)@ViewBag.MyPays)
</div>
<div class="display-field">
@Html.Label("Téléphone :")
@Html.Label((string)@ViewBag.Corres(7))
@Html.Label("Fax :")
@Html.Label((string)@ViewBag.Corres(8))
@Html.Label("Email :")
@Html.Label((string)@ViewBag.Corres(9))
</div>
</fieldset> |
Partager