Open daveaglick opened 9 years ago
After some thoughts, maybe a cleaner approach would be to implement separate extensions (just to separate singular Radio
and the multiple ones):
RadioList
first parameter takes name
as a string
RadioListFor
first parameter takes the usual lambda expression to the view model.The second parameter can be either:
string
and generates multiple radio inputs using each string
as the HTML label
and value
property.KeyValuePair<string,string>
and uses each Key
property as the HTML label
property and the Value
property as the value
for the inputs.And like SelectFor
, RadioListFor
will also check / select the value that matches the property value when the page is rendered.
For example, a
Radio
and/orRadioFor
extension(s) that takes a sequence ofKeyValuePair<string, object>
and creates multiple radio buttons. What needs to be passed in? The description and value? What about label?