Radiobuttons in Datagrid Template Columns in 1.1

Discussion in 'ASP .Net' started by daokfella, Nov 16, 2007.

  1. daokfella

    daokfella Guest

    I have three datagrid template columns each with a radiobutton
    assigned to the same group. If I determine that the third and only
    third radiobutton should be selected, I'll select it in ItemDataBound
    and then disable all three. However, when I loop through the datagrid
    items after responding to a button click event on the page, it always
    returns the first radiobutton as checked even though it isn't. It
    looks like if the radiobuttons are enabled, it works fine. There's
    just a problem if they are disabled. Anybody else encounter this? It
    seems like an MS bug. If I change the order of the Case statements,
    the very first is always seen as TRUE if the radiobutton is disabled
    (even though it's not checked).


    ' Loop through datagrid updating Available Years.
    For Each item As DataGridItem In dgrRegYear.Items

    Dim rb1 As RadioButton
    Dim rb2 As RadioButton
    Dim rb3 As RadioButton
    rb1 = CType(item.FindControl("rb1"), RadioButton)
    rb2 = CType(item.FindControl("rb2"), RadioButton)
    rb3 = CType(item.FindControl("rb3"), RadioButton)

    Select Case True
    Case rb1.Checked
    ' THIS IS ALWAYS HIT EVEN THOUGH THE RADIOBUTTON IS NOT CHECKED!
    Case rb2.Checked
    Case rb3.Checked
    End Select

    Next
    daokfella, Nov 16, 2007
    #1
    1. Advertising

  2. daokfella

    daokfella Guest

    It appears as though .Net will grab the value from the most-recent
    "non-disabled" radiobutton with the same name....even it it resides in
    a previous datagrid row. The only way around this was to hide and not
    disable the radiobuttons via styles (unfortunately, setting the
    visible property to false has the same effect as disabling them).
    daokfella, Nov 20, 2007
    #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. RB

    RadioButtons & DataGrid

    RB, Aug 11, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    395
  2. rwornor
    Replies:
    0
    Views:
    2,317
    rwornor
    Mar 1, 2008
  3. Sheikh Nabeel Moeen

    Grouping RadioButtons in a DataGrid

    Sheikh Nabeel Moeen, Sep 15, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    116
    Sriram Mallajyosula
    Sep 22, 2004
  4. John A Grandy

    DataGrid with TemplateColumn of CheckBoxes or RadioButtons

    John A Grandy, Sep 17, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    120
    John A Grandy
    Sep 17, 2004
  5. Vinki

    template columns and bound columns in gridview

    Vinki, Apr 25, 2007, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    847
    Vinki
    Apr 25, 2007
Loading...

Share This Page