<table> <tr> <th>Nom</th> <th>Marque</th> <th>Model</th> <th>Nuemro</th> <th>Plage</th> </tr> @foreach (var item in ((List <site> )TempData["listesite"]).GroupBy(x => x.Nom)) { <tr> <th>@item.Key</th> <th colspan="4"></th> </tr> foreach (var data in ((List<site> )TempData["listesite"]).Where(x => x.Nom == item.Key)) { <tr> <td></td> <td>@data.Marque</td> <td>@data.Model</td> <td>@data.Numero_serie</td> <td>@data.Plage</td> </tr> } } </table>
public ActionResult Index() { TestEntities db = new TestEntities(); TempData["listesite"] = db.Sites.ToList(); return View(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)