Change Radio button label color

  1. #1

    Change Radio button label color

    Hi All,

    Is it possible to change the color of a label of a radio button in asp.net it s done using syntax like :

    RadioButtonList1.Items.FindByText("Radio").Attributes.Add("style", "color:red");
    i tried :

    Radio1.Attributes.Add( Radio1.LabelStyle, "color:#456723");
              Radio1.Attributes.Add("CssStyle", "color:blue");
              Radio1.Attributes.Add("Style", "color:gray");
    None of hem are working .any one has a better ideas

    Cheers ;)
    Last edited by geoffrey.mcgill; Sep 17, 2010 at 4:32 PM. Reason: please use [CODE] tags
  2. #2
    Try Style Sheet (.css)

    Cheers ;)
  3. #3
    Hi,

    You can assign a css class to the Component.

    Example

    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
        
        <style type="text/css">
            .red {
                color : red;
            }
        </style>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:Radio ID="Radio1" runat="server" BoxLabel="Testing" Cls="red" />
        </form>
    </body>
    </html>
    Hope this helps.
    Geoffrey McGill
    Founder
  4. #4
    We're going to add a new .BoxLabelStyle property.

    A ticket has been created, see

    http://extnet.lighthouseapp.com/proj...style-property

    Once added, the following sample will work.

    Example

    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:Radio 
                ID="Radio1" 
                runat="server" 
                FieldLabel="Test" 
                BoxLabel="Description" 
                BoxLabelStyle="color:red;" 
                />
        </form>
    </body>
    </html>
    Geoffrey McGill
    Founder
  5. #5
    Thank you so much geoffrey
    i really appreciate your help. for the moment i use your first suggestion
    hopefully the BoxLabelStyle in the radio exists soon.
    Cheers :o
  6. #6
    Hi,

    The .BoxLabelStyle and .BoxLabelCls properties have been added to the CheckboxBase class.

    The new properties will be publicly available with the upcoming v1.0 Beta release.
    Geoffrey McGill
    Founder

Similar Threads

  1. [CLOSED] How to change text color in Ext Button
    By UnifyEducation in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 25, 2012, 1:42 PM
  2. Radio Button Change Event
    By zghidi in forum 1.x Help
    Replies: 1
    Last Post: Jan 31, 2011, 2:48 PM
  3. [CLOSED] [1.0] Change in radio button behavior - inputvalue
    By betamax in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 18, 2010, 4:02 PM
  4. How to change the font color for Ext Label
    By rasu_13 in forum 1.x Help
    Replies: 0
    Last Post: Apr 03, 2010, 3:12 AM
  5. Replies: 1
    Last Post: Mar 29, 2010, 6:29 PM

Posting Permissions