I have the following model:
public class Person
{
public string Name { get; set; }
public string Gender { get; set; }
}
I want the
I took this idea and expanded on it. I pass a List to my editor template as added ViewData that I use to create the radio buttons. My template looks like this
@model string
@{
var buttons = (List>)ViewData["Buttons"];
}
@foreach (var button in buttons) {
}
this is what I'm passing to my EditorFor as additional ViewData
new { Buttons = new List> { new Dictionary { { "Label", "Commercial" }, { "Value", "Y" } }, new Dictionary { { "Label", "Residential" }, { "Value", "N" } } } }
Granted I could add this to a ViewModel type and pass that to the View from my controller, however it was quicker to do it in the cshtml file.