asp.net - How to apply css style on a RadioButtonList

RadioButtonList CssClass
radiobuttonlist is a single selection radio button group. in this example we will apply core css style in asp.net radiobuttonlist. it will change the holl design of radiobuttonlist and list items. after a button click, we will programmatically set the radiobuttonlist css class property. css class is previously defined in document header section. copy and paste the code in your IDE, run it and look the change made after clicking button. radiobuttonlist text color, font family, font size and font style are changed.
RadioButtonListCssClass.aspx

<%@ Page Language="C#" AutoEventWireup="true" %>

<!DOCTYPE html>

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        RadioButtonList1.CssClass = "RadioButtonListCssClass";
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to use RadioButtonList CssClass in asp.net</title>
    <style type="text/css">
        .RadioButtonListCssClass
        {
            color:Red;
            font-family:Comic Sans MS;
            font-size:large;
            font-style:italic;
            }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:OliveDrab; font-style:italic;">
            How to use RadioButtonList CssClass in asp.net
        </h2>
        <hr width="475" align="left" color="Olive" />
        <asp:RadioButtonList
             ID="RadioButtonList1"
             runat="server"
             RepeatColumns="2"
             >
            <asp:ListItem Text="FloralWhite"></asp:ListItem>
            <asp:ListItem Text="DarkSlateGray"></asp:ListItem>
            <asp:ListItem Text="DimGray"></asp:ListItem>
            <asp:ListItem Text="FireBrick"></asp:ListItem>
            <asp:ListItem Text="Fuchsia"></asp:ListItem>
        </asp:RadioButtonList>
        <br />
        <asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Apply RadioButtonList CssClass"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            />
    </div>
    </form>
</body>
</html>
More asp.net examples