FluentBootstrap icon indicating copy to clipboard operation
FluentBootstrap copied to clipboard

Extensions to make sequences of form elements

Open daveaglick opened this issue 10 years ago • 1 comments

For example, a Radio and/or RadioFor extension(s) that takes a sequence of KeyValuePair<string, object> and creates multiple radio buttons. What needs to be passed in? The description and value? What about label?

daveaglick avatar May 26 '15 15:05 daveaglick

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:

  • A sequence of string and generates multiple radio inputs using each string as the HTML label and value property.
  • A sequence of 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.

ryanelian avatar May 26 '15 16:05 ryanelian