[CLOSED] How to style FieldLabel (set text to bold)

  1. #1

    [CLOSED] How to style FieldLabel (set text to bold)

    I attempted the following property being set on the control that I want the label to be bolded. It never takes effect or even renders the style at all when I view source.

    ..DisplayField runat="server" id="xxx" ... LabelStyle="font-weight: bold;" ...
  2. #2
    For me all works as expected
    Please provide your test case

    <%@ 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 id="ctHtml" xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ResourceManager ID="ResourceManagerMain" runat="server" />
             
            <ext:Panel 
                runat="server" 
                Title="Label Style" 
                Width="400"
                Layout="Form">            
                <Items>
                    <ext:TextField 
                        runat="server" 
                        FieldLabel="Label" 
                        LabelStyle="color:blue;font-weight:bold;" 
                        AnchorHorizontal="95%" 
                        />
                </Items>
            </ext:Panel>
             
        </form> 
    </body>
    </html>
  3. #3
    When I run your sample in the same container as my fields, I see this in the rendered source:

    <label id="ext-gen139" class="x-form-item-label" style="width: 100px;">Label:</label>
    No style is added from LabelStyle.


    These controls would be inside a container if that matters. Also they need to be DisplayFields not TextFields (but I think the label style will work the same once fixed).

    I will run your sample standalone and see how it works, but the real case is I need the labels to be the correct style inside the Panel -> Container.


    Quote Originally Posted by Vladimir View Post
    For me all works as expected
    Please provide your test case

    <%@ 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 id="ctHtml" xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ResourceManager ID="ResourceManagerMain" runat="server" />
             
            <ext:Panel 
                runat="server" 
                Title="Label Style" 
                Width="400"
                Layout="Form">            
                <Items>
                    <ext:TextField 
                        runat="server" 
                        FieldLabel="Label" 
                        LabelStyle="color:blue;font-weight:bold;" 
                        AnchorHorizontal="95%" 
                        />
                </Items>
            </ext:Panel>
             
        </form> 
    </body>
    </html>
  4. #4
    Please note that LabelStyle works if a field inside container with FormLayout only
  5. #5
    Quote Originally Posted by Vladimir View Post
    Please note that LabelStyle works if a field inside container with FormLayout only
    Thanks this was it. Why is this though and is there any workaround to use a non Form layout with LabelStyle? I just ask because moving to layout type of Form breaks the rest of the page's layout.
  6. #6
    Only FormLayout manages field label UI
    You can wrap concrete field by container with FormLayout and do not change base container
  7. #7
    Quote Originally Posted by Vladimir View Post
    Only FormLayout manages field label UI
    You can wrap concrete field by container with FormLayout and do not change base container

    Thanks. This one can be closed. Wrapping just the item I need to style in container worked.

Similar Threads

  1. [CLOSED] Problem with Bold FieldLabel
    By John_Writers in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 16, 2012, 11:09 AM
  2. [CLOSED] Change the Font style to Bold for a Row in Grid View
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Nov 10, 2011, 11:50 AM
  3. [CLOSED] how to make a text area bold
    By Hari_CSC in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 18, 2010, 4:21 PM
  4. FieldLabel- Bold
    By grmontero in forum 1.x Help
    Replies: 1
    Last Post: Sep 09, 2009, 7:52 PM
  5. Header Style Bold
    By simonmicheal in forum 1.x Help
    Replies: 0
    Last Post: Aug 19, 2009, 1:12 PM

Posting Permissions