Home > DeveloperSection > Forums > How to access radiobutton in RadioButtonList
john rob

Total Post:108

Posted on    September-05-2014 12:20 AM

 VB.Net VB.Net 

 1 Reply(s)
 1360  View(s)
Rate this:

I want to change the CssClass for the RadioButtonList while populating the the RadioButtonList. I don't know how to access the radio button while binding the list. do I need to use DataBind or DataBounding event ? 

Sumit Kesarwani

Total Post:378

Posted on    September-05-2014 1:05 AM

Hi John, 

Use the DataBound event as then all of the Radio Buttons will be populated.

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


End Sub

Don't want to miss updates? Please click the below button!

Follow MindStick