Solved

Binding Radio Buttons

Posted on 2009-07-16
4
443 Views
Last Modified: 2012-05-07
Hi Thanks for clicking.

This is something you'd think was easy, but the hassle it's given me.

Want to Bind to 7 radio buttons a Text database field

This Text field can have 7 states, namely Intruder, Fire, Access, Social, Vehicle, CCTV and Other

Obviously the 7 buttons fit exactly to this. So obviously we choose the appropriate one upon Binding.

However, what do we bind to?? Thought of using a FlowPanel ( a fancy panel) , and using the Tag property of this to bind to this field. After that we interpret the Tag property and therefore check or uncheck the appropriate radio button.

Vice Versa, when we change the Radio button we manually change the Tag property of the Panel, and therefore should upload as normal on save like any other control on our form.

Which property and what event of the Panel shoud I use to do this job?? Tried using the Tag property and BindingContextChanged event, but doesn't change the Tag property for some reason, even though it's bound.

We use VS2005 and SQLSERVER2005

I'd be most grateful
0
Comment
Question by:StuartK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24876589
>This Text field can have 7 states, namely Intruder, Fire, Access, Social, Vehicle, CCTV and Other
Do you mean you store 7 strings in one field delimited with some character? Then why you need radio buttons? Why not checkboxes? Please explain in detail. Are you using design time binding?
0
 

Accepted Solution

by:
StuartK earned 0 total points
ID: 24877348
First off thanks for posting
We are using Design Time Binding. We also use a BindingSource control
As for the field it is a String field called "Description" and can be only one of the 7 choices namely Intruder, Fire, Access, Social, Vehicle, CCTV and Other
Depending what that field is we want to Depress one of the 7 toggle buttons (radio buttons with Appearance property set to "Button") namely btnIntruder, btnFire, btnAccess, btnSocial, btnVehicle, btnCCTV and btnOther.
Then if the toggle buttons are pressed by the user and Save is done, the database field "Description" changes to reflect that change.
Any thoughts?? This should be easy, don't know why it's proved such a problem, but it has. I search all the internet and nothing works for Binding.
Thanks Stu
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 100 total points
ID: 24877361
I think you have to inherit the default radio button because radio button binds to boolean fields. The inherited control would check the Description field for a text string and if that string matches its name or tag property (whichever you decide to use) then the radio button would set itself checked. Here is an example of inheriting

http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_24568376.html?cid=1131#a24857560
0
 

Author Comment

by:StuartK
ID: 24934188
Sorted by using controls from Janus Suite. This allows a CheckedValue property to bind to the radio button set up as a toggle button,and also binding using a BindableValue property.
Thanks for all your help, I always award points even for suggestions that didn't turn out to be my particular solution, but might well be others.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question