Radiobuttons in Datagrid Template Columns in 1.1

D

daokfella

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
 
D

daokfella

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).
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top