RadioGroup Name to bound model property

0 Answers 54 Views
RadioGroup
Nikita
Top achievements
Rank 1
Iron
Nikita asked on 24 Apr 2023, 04:23 PM

I declare a radio button group on the page inside a list-type control (or a @foreach loop). Radio button group is bound to a model property and needs to have its name prefixed with an index like so: "Model[0].PropOne". When I use @Html.Name helper with other controls like a checkbox it works right, but with radio buttons it produces a name like this - Model_0__PropOne. So, looks like it replaces brackets and dots with an underscore. What do I need to do to get it to work?

Anton Mironov
Telerik team
commented on 27 Apr 2023, 12:09 PM

Hi Nikita,

Thank you for the details provided.

Yes, you are totally correct - this behavior is expected as the Button Group has its collection of options. The component bonded to the Model should work out of the box. 

If further manipulations of the options are needed, feel free to get them and use their properties via Regular Expressions.

If you could provide a runnable sample with the desired points explained, I could try to achieve the requirements for the case.

Looking forward to hearing back from you.

Kind Regards,
Anton Mironov

No answers yet. Maybe you can help?

Tags
RadioGroup
Asked by
Nikita
Top achievements
Rank 1
Iron
Share this question
or