473,624 Members | 1,993 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Databound Radiobuttons

Hello,

I have two databound radiobuttons which have advanced databinding properties
of onpropertychang ed enabled so that I can raise the columnchanged event
whenever the radiobuttons are changed.

In the columnchanged event I am simply accepting changes into the dataset.
There is no dataadapter because it is a standalone dataset.

When one radiobutton is already checked (as opposed to neither) and I select
the non-checked radiobutton, the columnchanged event is raised twice and
erases the checked value of both radiobuttons in the acceptchanges call. It
is raised twice because it is first raised to un-check the first radio
button, and then called again to check the second radio button... but on the
second call it somehow sees that the second radio button is not physically
checked yet, so sends a false value.

This is pretty simple to reproduce and funnily enough nothing seems to be
available on the net to explain this with radiobuttons.
Troy
Mar 7 '06 #1
4 2096
Probably to explain a little better:

You have Radiobutton #1 and Radiobutton #2.

If #1 is checked and you click #2, firstly the two radiobuttons physically
swap the checked status and are visibly correct. Then the columnchanged
event is raised for the dataset. The event is firstly handled for #1 and
acceptchanges is called... this causes the new false value for #1 to be
saved, *and* for the existing false value for #2 (still false on the
datarow), triggering the stored value and the checked value for #2 to be
changed to false. This triggers the columnchanged event again and simply
places false values into the radiobutton databound columns with
acceptchanges.

Is there any way to break that cycle?
Troy
"news.microsoft .com" <tr**@NO-SPAMebswift.com > wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hello,

I have two databound radiobuttons which have advanced databinding
properties of onpropertychang ed enabled so that I can raise the
columnchanged event whenever the radiobuttons are changed.

In the columnchanged event I am simply accepting changes into the dataset.
There is no dataadapter because it is a standalone dataset.

When one radiobutton is already checked (as opposed to neither) and I
select the non-checked radiobutton, the columnchanged event is raised
twice and erases the checked value of both radiobuttons in the
acceptchanges call. It is raised twice because it is first raised to
un-check the first radio button, and then called again to check the second
radio button... but on the second call it somehow sees that the second
radio button is not physically checked yet, so sends a false value.

This is pretty simple to reproduce and funnily enough nothing seems to be
available on the net to explain this with radiobuttons.
Troy

Mar 7 '06 #2
Hi,

http://msdn.microsoft.com/msdnmag/is...dvancedBasics/

Ken
-------------
"news.microsoft .com" <tr**@NO-SPAMebswift.com > wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hello,

I have two databound radiobuttons which have advanced databinding
properties of onpropertychang ed enabled so that I can raise the
columnchanged event whenever the radiobuttons are changed.

In the columnchanged event I am simply accepting changes into the dataset.
There is no dataadapter because it is a standalone dataset.

When one radiobutton is already checked (as opposed to neither) and I
select the non-checked radiobutton, the columnchanged event is raised
twice and erases the checked value of both radiobuttons in the
acceptchanges call. It is raised twice because it is first raised to
un-check the first radio button, and then called again to check the second
radio button... but on the second call it somehow sees that the second
radio button is not physically checked yet, so sends a false value.

This is pretty simple to reproduce and funnily enough nothing seems to be
available on the net to explain this with radiobuttons.
Troy

Mar 7 '06 #3
Thanks Ken, just curious if there is a known workaround without using a
custom control? I've got separate columns in the dataset for each
radiobutton... rather than the scenario of one column and separate values
for each radiobutton; it's a matter of semantics really, especially when
only dealing with only a couple of paired groups of radiobuttons.

I wanted to try and keep the solution simple and have no control-initiated
events to update the dataset outside of the databindings setting. I have
seen the custom control solution before, but I'm thinking that there has to
be a far simpler answer.

I think the biggest hurdle is getting around the dataset's acceptchanges
overriding the newly checked radiobutton with the old dataset contents,
sparking the change to be lost.
Troy
"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:Ot******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

http://msdn.microsoft.com/msdnmag/is...dvancedBasics/

Ken
-------------
"news.microsoft .com" <tr**@NO-SPAMebswift.com > wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hello,

I have two databound radiobuttons which have advanced databinding
properties of onpropertychang ed enabled so that I can raise the
columnchanged event whenever the radiobuttons are changed.

In the columnchanged event I am simply accepting changes into the
dataset. There is no dataadapter because it is a standalone dataset.

When one radiobutton is already checked (as opposed to neither) and I
select the non-checked radiobutton, the columnchanged event is raised
twice and erases the checked value of both radiobuttons in the
acceptchanges call. It is raised twice because it is first raised to
un-check the first radio button, and then called again to check the
second radio button... but on the second call it somehow sees that the
second radio button is not physically checked yet, so sends a false
value.

This is pretty simple to reproduce and funnily enough nothing seems to be
available on the net to explain this with radiobuttons.
Troy


Mar 8 '06 #4
I figured out a simple hack. At this stage I think it will only work with a
two radiobutton group.

Here's the hack:

Create the two radiobutton group and databind them to two separate table
values. Setup the databindings checked event for each radiobutton, and
under advanced, change the event type to onpropertychang ed. If you run the
project now, you will see the problem reproduced, where it actually takes
two clicks to change to a new radiobutton value. To fix this, in ONE of the
radiobutton column definitions, change the expression to 'Not
otherradiocolum n', where otherradiocolum n is the name of the table column
for the OTHER radiobutton. This will ensure that the radiobuttons always
switch and never cancel one another out.

If this solution could be expanded to three or more radiobuttons it would
remove the need for messy usercontrols, though I'm not sure it would be
possible.
Troy

"news.microsoft .com" <tr**@NO-SPAMebswift.com > wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hello,

I have two databound radiobuttons which have advanced databinding
properties of onpropertychang ed enabled so that I can raise the
columnchanged event whenever the radiobuttons are changed.

In the columnchanged event I am simply accepting changes into the dataset.
There is no dataadapter because it is a standalone dataset.

When one radiobutton is already checked (as opposed to neither) and I
select the non-checked radiobutton, the columnchanged event is raised
twice and erases the checked value of both radiobuttons in the
acceptchanges call. It is raised twice because it is first raised to
un-check the first radio button, and then called again to check the second
radio button... but on the second call it somehow sees that the second
radio button is not physically checked yet, so sends a false value.

This is pretty simple to reproduce and funnily enough nothing seems to be
available on the net to explain this with radiobuttons.
Troy

Apr 3 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2621
by: discomiller | last post by:
Mario Mueller: Hello *, radiobuttons belong to other radiobuttons by the "name="any_value"" attribut. Thats a fakt. I got the following XML: **************************************************************
3
1638
by: Martien van Wanrooij | last post by:
I am working on a site with some pages that all have a form that starts with a group of radiobuttons. By default none of the buttons is checked. Before submitting the form there is a validation script that verifies if a choice has been made. The following code works, but only for one individual page function showChecked() { if(!document.forms.heeftPartner.checked && !document.forms.heeftPartner.checked)alert ('Please answer this
1
1606
by: --=|3s|=-- | last post by:
Hi, I'm trying to create a form in VISUAL BASIC .NET wich shows values of records from a customers table. For example a form wich shows the name, surname and sex of a person. For the name & surname i create a textbox. then I select the correct table in the databinding propertie of the name and surname textbox. but for showing the correct sex of a person, i would like to use a radiobuttons. So i create 2 radiobuttons on my form (rbMale &...
11
4650
by: Rourke Eleven | last post by:
I have looked and searched. What good is the databind property on Radiobuttons? How does one go about actually using it? What is a good resource on this? I understand that I can easily get/set the information I need programmatically, but what about the databind property I just don't understand it's value.
2
15054
by: Chris Ashley | last post by:
I have a couple of RadioButtons both with the same GroupName. Is there any way I can use a RequiredFieldValidator to ensure that at least one of the RadioButtons in the group is selected? Setting ControlToValidate to the GroupName doesn't seem to work, and obviously setting it to the ID of one of the individual RadioButtons won't work.. any ideas? Thanks in advance, Chris
0
1423
by: PaulS | last post by:
Hello! I put on Form PictureBox and I set big image. Next I put many radiobuttons (80) on PictureBox, but I have problem. I want that 10 radiobuttons have own Checked, next part of 10 radiobuttons have own Checked, etc. I tried add GroupBox on PictureBox, next add RadioButtons. But there is problem that I can't set visible only RadioButtons on image (GroupBox must be hidden). I tried option: "Send to Back" but it hide also
4
1701
by: PedroVision | last post by:
I have a VB 2005 form with 140 different radiobuttons... Some are "checked", some are not... I want to reset all radiobuttons to "unchecked". I've been searching and trying differnet things...there must be a way to access radiobuttons by their "names"... Typical names used include... RadioButton011
8
44025
by: =?Utf-8?B?UmljaA==?= | last post by:
If you enclose a group of radiobuttons (option buttons in MS Access) in an option group control (a frame control) in Access -- the frame control will return the index of the option button that is checked. In VB.Net if I enclose a group of radiobuttons in a groupbox control - I get the single checked radiobutton behavior, but the groupbox does not seem to return the index of the checked radiobutton. Is there a way to get the groupbox...
0
1040
by: | last post by:
I am using radiobuttons in a gridview, and not a column of radiobuttons. I have one cell in each row with several radiobuttons that the user has to choose a radiobutton within each row. How can I capture which radiobutton in which row the user has clicked. Even with AutoPostback=true, the gridview's rowcommand doesn't fire. The rowcreated event does, but I can't tell which row I'm on. Thanks for your help.
0
8236
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8621
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8475
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7159
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.