我想在填充RadioButtonList
时更改RadioButtonList的CssClass
。我不知道如何在绑定列表时访问单选按钮。我需要使用DataBind
还是DataBounding
事件?如何?
使用DataBound事件,因为所有单选按钮都将被填充。
Private Sub YourRadioButtonList_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles YourRadioButtonList.DataBound
For Each rd As RadioButton In YourRadioButtonList.Items
'Or some other condition that determines the CSS Class.
If rd.Checked Then
rd.CssClass = "NewCssClass"
End If
Next
End Sub