I am taking an string[] from my Model and it has about 25ish strings in it at any given time.
@model PostProcessPartSelectionViewModel
@{
var i = 0;
foreach (var part in Model.PartsAllowedAsSeed)
{
<input type="checkbox" id="[@i]" name="PartsAllowedAsSeed" value="@part" />
<span>@part</span>
<br />
i++;
}
}
I set up a @foreach loop in Razor to display a checkbox and label for each string, but when I debug, @part renders to System.Object[]. There are 25 checkboxes with 25 "System.Object[]" labels.
Eventually, I'm going to want to return any checked strings back to the model, but right now I just want to know how I can get Razor to render the actual string value.
PartsAllowedAsSeedproperty is an array of objects, so"System.Object[]"is the actual string value. What are you trying to do with the objects found in those arrays?partinPartsAllowedAsSeedwould be something like{"a", "b", "c"}? In that case, what string do you want it to output in your<span>?