View Full Version : [CLOSED] RadioFor Razor Example

Apr 06, 2015, 8:23 AM
I can't find any examples of using RadioFor for a view model property in Razor.
There should be three radio button that select a different value for the model property.
Can you please post a code snippet of how this is achieved with RadioFor?

Thank you

Apr 06, 2015, 4:37 PM
Hi @registrator,

It looks we don't have such an example. This thread might help.

Apr 07, 2015, 7:16 AM
Hi Daniil

I ended up doing this, found an example in the the 2013 MVC examples solution:

X.RadioGroupFor(m => m.PAYMENT_TYPE, new List<Radio.Config> {
new Radio.Config{BoxLabel = "Received", InputValue = "Received"},
new Radio.Config{BoxLabel = "Account", InputValue = "SA"},
new Radio.Config{BoxLabel = "Invoice", InputValue = "SR"}

But I can't make them display vertically. The Vertical direction is not working. If this is what it is used for?
how do you lay them out vertically instead of horizontally?

Apr 07, 2015, 11:36 AM
I would also try to set .ColumnsNumber(1).

Apr 08, 2015, 10:21 AM
This solves it.
Thank you.