Microsoft KB Archive/185566

= PRB: Radio Button Does Not Bind Correctly to Boolean =

Article ID: 185566

Article Last Modified on 5/11/2006

-

APPLIES TO


 * Microsoft Internet Client Software Development Kit 4.0
 * Microsoft Internet Client Software Development Kit 4.01

-



This article was previously published under Q185566



SYMPTOMS
 tags of type RADIO do not seem to bind to Boolean data correctly. This would occur in a RADIO group where one RADIO button would have a value of "true" and the other would have the value or "false."



CAUSE
For reasons that are apparent when you consider a text column bound to a text box, the string comparisons are case-sensitive. Zero and 1 are converted to "False" and "True" (notice the uppercase letters), respectively.

When a record from a bound data source is navigated to, the DATAFLD that the RADIO button is bound to is evaluated and converted to "True" or "False" before deciding which RADIO button to select. If the RADIO button's values are set to "true" and "false" (notice the lowercase letters), then the value returned from the data source would be equal to neither. For this reason, neither RADIO button will be selected.



RESOLUTION
If you change "true" and "false" in your page to "True" and "False," respectively, the page will behave as you desire.



STATUS
This behavior is by design.



Sample of Incorrect HTML
This is a sample page that show one RADIO values correctly and the other one incorrectly set for Databinding to a Boolean field:      Sub btnNext_OnClick RDS1.recordset.MoveNext If RDS1.recordset.eof Then RDS1.recordset.MoveFirst End If  End Sub   

<OBJECT classid=clsid:BD96C556-65A3-11D0-983A-00C04FC29E33 height=1 id=RDS1 width=1> <PARAM NAME="SERVER" VALUE="HTTP://YOURSERVER"> <PARAM NAME="CONNECT" VALUE="DSN=NWIND;"> <PARAM NAME="SQL" VALUE="SELECT * FROM PRODUCTS"> </OBJECT> <P> </P>

<INPUT NAME=rdoDiscontinued TYPE=RADIO DATASRC=#RDS1 DATAFLD=Discontinued Value="True">True (When Discontinued, this radio button will be selected.)<BR> <INPUT NAME=rdoDiscontinued TYPE=RADIO DATASRC=#RDS1 DATAFLD=Discontinued Value="false">false (This one will never be selected)<BR> Discontinued:<INPUT NAME=txtDiscontinued TYPE=TEXT DATASRC=#RDS1 DATAFLD=Discontinued readonly><BR> <INPUT TYPE=BUTTON NAME=btnNext VALUE="NEXT"> </BODY> </HTML>

<div class="references_section">