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

Discussion in 'ASP .Net Web Controls' started by Steven, May 16, 2005.

  1. Steven

    Steven Guest

    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
     
    Steven, May 16, 2005
    #1
    1. Advertising

  2. Steven

    Patrice Guest

    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

    --

    "Steven" <> a écrit dans le message de
    news:...
    > 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
    >
     
    Patrice, May 17, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hy
    Replies:
    0
    Views:
    405
  2. Carlos
    Replies:
    1
    Views:
    887
    Jc Morin
    Feb 24, 2005
  3. RisingFish
    Replies:
    0
    Views:
    385
    RisingFish
    Oct 10, 2006
  4. bdb112
    Replies:
    45
    Views:
    1,370
    jazbees
    Apr 29, 2009
  5. Hiten
    Replies:
    1
    Views:
    663
    Vidar Petursson
    May 26, 2004
Loading...

Share This Page