PDA

View Full Version : [CLOSED] RadioFor Razor Example



registrator
Apr 06, 2015, 9: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

Daniil
Apr 06, 2015, 5:37 PM
Hi @registrator,

It looks we don't have such an example. This thread might help.
http://forums.ext.net/showthread.php?4394

registrator
Apr 07, 2015, 8: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"}
}).Vertical(true)


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?

Daniil
Apr 07, 2015, 12:36 PM
I would also try to set .ColumnsNumber(1).

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