我想在填充CssClass
时更改RadioButtonList的RadioButtonList
。我不知道在绑定列表时如何访问单选按钮。我需要使用DataBind
或DataBounding
事件吗?如何 ?
答案 0 :(得分:0)
使用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