How to display every property in checkbox inside one line
I have object features which have many properties, these properties are dynamically assigned and I do not want to hard code these in the view.
So, right now I have something like these
@Html.CheckBoxFor(model => model.Features.IsRegistered, new { @disabled = "disabled" })
@Html.CheckBoxFor(model => model.Features.IsPhone, new { @disabled = "disabled"
…. and many more
how to render exactly like these above but for all object properties, is this possible?
Thanks
I’ve only done some limited testing with this, but here’s a basic implementation of an extension method you can play with:
You may wish to expand on it to allow it to take HTML attributes as well, rather than hard-coding them, but this should get you started.