I have group of radio buttons, each group ranges from 5 - 27 radiobuttons. And if any radio button in a group is checked I store 1 in db else I store 0. Now I'm checking each radiobutton using if loop to see if they are checked and set database value. I'm also trying to use the code below. Is there a good/better approach to check if they are checked or not?
Current code:
'rname is radiobutton prefix for a given group
'cnt is number of radiobuttons in the group
Private Function RadioIsChecked(ByVal rname As String, ByVal cnt As Integer) As Integer
Dim retval As Integer = 0
For i = 0 To cnt - 1
Dim rdbName As String = rname & i
Dim rdb As New RadioButton()
rdb = CType(Me.Page.FindControl(rdbName), RadioButton)
If rdb.Checked Then
retval = 1
End If
Next
Return retval
End Function
Note: I cannot use radio button list. I know this can be achieved easily using this but i want to get solution for radiobutton