Home All Groups Group Topic Archive Search About

Radio Button when checked evaluates to true?????

Author
16 May 2005 4:04 PM
Steven
I have a real strange page built with framework 1.1 vb asp.net

On this page I have a set of radio buttons.
---------------
Protected WithEvents rbStandard As
System.Web.UI.WebControls.RadioButton
Protected WithEvents rbCustom As System.Web.UI.WebControls.RadioButton
---------------
When you select one of the buttons and post the page back to the server
with a break point where I read the checked property, it is false.
However, when it passes the line of code where it ask "if
rdostandard.checked = true then..." it always evaluates this as true
and does the ...

If I "dim test as string" and then "test =
rdostandard.checked.tostring" and and check the value in test it is
"FALSE".  Then I run the code "If ucase(test) = "TRUE" then...." it
does the ....
---------------
Dim test As String

test = rbStandard.Checked.ToString

If UCase(test) = "TRUE" Then TotalPercent = Round(TotalPercent, 0)

'If rbStandard.Checked = True Then TotalPercent = Round(TotalPercent,
0)

---------------
Any one have any idea what could be causing such behavior?

Thanks

Author
17 May 2005 12:45 PM
Patrice
Just does a test page that write down the boolean value and tell us also in
which event you do that... Make sure also you don't reinit again the control
somewhere...

As a side note, though this is not a problem a boolean value is already
true/false in itself (you could use If MyValue Then rather than If
MyValue=True Then...)

Patrice

--

Show quoteHide quote
"Steven" <stmth***@gapac.com> a écrit dans le message de
news:1116259472.442482.113740@g43g2000cwa.googlegroups.com...
> I have a real strange page built with framework 1.1 vb asp.net
>
> On this page I have a set of radio buttons.
> ---------------
> Protected WithEvents rbStandard As
> System.Web.UI.WebControls.RadioButton
> Protected WithEvents rbCustom As System.Web.UI.WebControls.RadioButton
> ---------------
> When you select one of the buttons and post the page back to the server
> with a break point where I read the checked property, it is false.
> However, when it passes the line of code where it ask "if
> rdostandard.checked = true then..." it always evaluates this as true
> and does the ...
>
> If I "dim test as string" and then "test =
> rdostandard.checked.tostring" and and check the value in test it is
> "FALSE".  Then I run the code "If ucase(test) = "TRUE" then...." it
> does the ....
> ---------------
> Dim test As String
>
> test = rbStandard.Checked.ToString
>
> If UCase(test) = "TRUE" Then TotalPercent = Round(TotalPercent, 0)
>
> 'If rbStandard.Checked = True Then TotalPercent = Round(TotalPercent,
> 0)
>
> ---------------
> Any one have any idea what could be causing such behavior?
>
> Thanks
>