How to change the Font Size of RadioButtonList in ASP.Net

Last Reply on Jul 08, 2013 02:30 AM By ashusingh

Posted on Jul 06, 2013 11:31 PM

I want to change the font size/text size of radiobuttonlist. I used the following code: 

<asp:RadioButtonList ID="rblCatName" runat="server" Font-Size="9px"  AutoPostBack="true" RepeatDirection="Horizontal" onselectedindexchanged="rblCatName_SelectedIndexChanged">
but it is working. I also tried in the code behind but is not working: 
protected void rblMainCatName_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            rblCatName.Items.Clear();            
            string strQuery = "Select * from MT_Category where MTId='" + rblMainCatName.SelectedItem.Value + "' and IsActive=0";
            SqlDataAdapter daCat = new SqlDataAdapter(strQuery, con);
            DataSet dsCat = new DataSet();
            daCat.Fill(dsCat);
            if (dsCat.Tables[0].Rows.Count > 0)
            {
                rblCatName.DataSource = dsCat.Tables[0];
                rblCatName.DataTextField = "CatName";
                rblCatName.DataValueField = "MCId";
                rblCatName.DataBind();                
               rblCatName.Font.Size =FontUnit.Smaller;
            }
        }
        catch (Exception ex)
        {

            throw ex;
        }
    }
Please suggest me what is should do to change the radiobuttonlist font size.

 

Posted on Jul 08, 2013 02:30 AM

hi

Try this

 <asp:RadioButtonList ID="rblUsers" runat="server" Style="font-size: 12px;">
        <asp:ListItem Text="Ashutosh" Value="1"></asp:ListItem>
        <asp:ListItem Text="Ashu" Value="2"></asp:ListItem>
        <asp:ListItem Text="Adnaan" Value="3"></asp:ListItem>
    </asp:RadioButtonList>