我有 2 个问题和答案数组。问题和答案在各自的数组中排列。我正在尝试使用以下代码设置单选按钮列表。但我无法设置。SelectedIndex 始终返回负一 (-1) 的值.
For i As Integer = 0 To Questions.Length - 1
CurQuestion = Questions(i)
CurAnswer = Answers(i)
Dim rbl As RadioButtonList = DirectCast(plcHolderForm.FindControl("Question_" & CurQuestion), RadioButtonList)
rbl.SelectedIndex = rbl.Items.IndexOf(rbl.Items.FindByValue("CurAnswer".ToString))
Next