I'd like to create a view that lists erorrs occured, while executing some action in a controller. I know how to create views while using a model, but can it be done without using a model? Just by passing simple list of strings?
I've created an action for the view with errors:
public ActionResult ListOfErrors(List<string> listOfErrors)
{
return View(listOfErrors);
}
And a view for this action:
@model List<string>
<table>
<thead>
<tr>
<th>
Error
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@item.ToString();
</td>
</tr>
}
</tbody>
</table>
If I do it like this I just get System.Collections.Generic.List``1[System.String];
. What should I change?