PDA

View Full Version : Two-way data binding with Radio Buttons?


Alistair
07-21-2005, 07:14 AM
Hi

Has anyone come up with an approach for using Spring's two-way data binding with the ASP.Net radio button control. I haven't thought about it too hard yet, but as there is no "radio button group" control to bind to, it seems like you need to setup a bool property on the page for each radio button to bind to and then in the Set property, actually update the underlying data object that represents the "real" bound data.

Is there a simpler or more elegant way of achieving this?

Thanks
Alistair

Alistair
07-25-2005, 02:49 AM
The ASP.Net RadioButtonList control will probably work, but the (X)HTML output of that control is so poor I was hoping to avoid it. It might be the lesser of two evils though...

Aleks Seovic
08-13-2005, 04:38 PM
Yeah, you should be able to use RadioButtonList, but you can also write your own RadioButtonGroup control that will have necessary boolean logic (as you described in the original post) and expose string Value property that you can bind to your data model.

Come to think of it, we should probably include such control in the framework -- I really don't understand why it's not in the ASP.Net itself already.

- Aleks

Alistair
08-14-2005, 11:11 AM
Aleks

Thanks for the tip - this is exactly what we're doing now as the RadioButtonList control is way too limiting in terms of the HTML that it produces!


:-)

Regards
Alistair

Aleks Seovic
08-14-2005, 02:55 PM
Cool. If you have something that works well and you would like to contribute, you can send it to me and I'll include it into Spring.Web.

- Aleks