I'm passing a Stored Procedure into my Controller, which I then want to send to my View and log each entry of the Stored Procedure into a dropdown menu. My problem is that when I pass the data over to the dropdown menu, all I get is System.String[] instead of the actual value.
Controller:
public ActionResult Dropdown()
{
ViewData["ids"] = db.uspGetAllEventIds().ToArray();
return View();
}
View:
@model IEnumerable<Heatmap.Models.Event>
...
<body>
<div>
<select name="EventId">
@for (var i = 0; i < 6; i++)
{
<option>@ViewData["ids"]</option>
}
</select>
</div>
</body>
Right now I only have a simple for
loop set to 6, but I want to iterate through my entire ids
array (which should be filled with the values from db.uspGetAllEventIds()
and enter them into my dropdown menu. How should I set my loop up to do this?