Set a CSS class on an ASP.NET RadioButtonList ListItem

后端 未结 5 767
一整个雨季
一整个雨季 2020-12-17 08:41

Is there any way to set a CSS class on an input item in a radio button list? I\'d like to reference these form values by class in jQuery.

Given an ASP.NET RadioButto

5条回答
  •  有刺的猬
    2020-12-17 09:14

    Using .NET you could create an event handler to the RowBinding event. This would allow you to access the individual controls within each item in the list. Once you pull the RadioButton control, you could programaticaly set it's CssClass to apply your class on the RadioButton level.

    You could also use jquery to find the radio button controls that have myClass applied, and then apply another class to that.

    Third, you could just change the definition of MyClass to also specify that it's only applied to input elements under elements that have MyClass applied.

提交回复
热议问题