문제

I am trying to work with enums as properies in my models, as decribed in this Castle Monorail page But I am having some problems when populating a a radio button with that property.

I am using this nvelocity syntax in my view:

$formHelper.RadioField("myModel.MyEnumProperty", 1, "%{}")

(being 1 the integer value for the enum, and also the value that my model have)

How it should be done? Plus for an answer that also deals with the biding (which will probably be an issue as well)

도움이 되었습니까?

해결책

Using MonoRail Select Using Enum I did something like this:

#foreach($item in EnumToPairs(typeof(MyEnum)))
    $Form.RadioField("myModel.MyEnumProperty", $item.First)
    $Form.LabelFor("myModel.MyEnumProperty", $item.Second)
#end

And then on the controller, you would just use ARDataBind or DataBind normally.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top