Adding label after textfield

  1. #1

    Adding label after textfield

    Hello all,

    Maybe it is a very easy question but I could not find any solution to my problem.

    
    <ext:CompositeField ID="cfLengthofTravel" runat="server" Anchor="100%">     
                  <Items>
                        <ext:TextField ID="txtLengthofTravel" runat="server" FieldLabel="<%$ Resources:CommonTerms, LengthofTravel%>"
                                AllowBlank="false" MaxLength="10" Width="100" Flex="1"/>
                        <ext:Label ID="lblLengthofTravel" runat="server" FieldLabel="<%$ Resources:CommonTerms, Kilometer%>" Width="15"/>
                   </Items>
    </ext:CompositeField>
    I need show for example "km" label after textfield but I cannot.

    Any advise will be very helpful

    Click image for larger version. 

Name:	Untitled.jpg 
Views:	81 
Size:	8.5 KB 
ID:	5230
  2. #2
    Hi,
    maybe this could help you: https://examples1.ext.net/#/Form/Com...ield/Overview/

    Use <ext:DisplayField /> instead of label

    <ext:CompositeField ID="cfLengthofTravel" runat="server" Anchor="100%"  FieldLabel="<%$ Resources:CommonTerms, LengthofTravel%>" >     
                  <Items>
                        <ext:TextField ID="txtLengthofTravel" runat="server"  AllowBlank="false" MaxLength="10" Width="100" />
                        <ext:DisplayField ID="lblLengthofTravel" runat="server" Text="<%$ Resources:CommonTerms, Kilometer%>" Width="15"/>
                   </Items>
    </ext:CompositeField>
    This is from Examples:
                        <ext:CompositeField runat="server" FieldLabel="Time worked" CombineErrors="false">
                            <Items>
                                <ext:NumberField runat="server" DataIndex="Hours" Width="48" AllowBlank="false" />
                                <ext:DisplayField runat="server" Text="hours" />
                                <ext:NumberField runat="server" DataIndex="Minutes" Width="48" AllowBlank="false" />
                                <ext:DisplayField runat="server" Text="mins" />
                            </Items>
                        </ext:CompositeField>
    Last edited by ambruslaco; Dec 03, 2012 at 4:22 PM.
  3. #3
    Hi,

    Here's a sample for Ext.NET 2 if anyone is looking to upgrade in the future.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    
    
    <!DOCTYPE html>
        
    <html>
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:FormPanel 
                runat="server" 
                Title="Example" 
                Width="350" 
                Height="215" 
                BodyPadding="5">
                <Items>
                    <ext:FieldContainer runat="server" Layout="HBoxLayout">     
                        <Items>
                            <ext:TextField 
                                runat="server" 
                                FieldLabel="Length of Travel" 
                                Flex="1" 
                                />
                            <ext:DisplayField 
                                runat="server" 
                                Text="Km" 
                                Margins="0 0 0 5" 
                                />
                        </Items>
                    </ext:FieldContainer>
                </Items>
            </ext:FormPanel>
        </form>
    </body>
    </html>
    Hope this helps.
    Geoffrey McGill
    Founder

Similar Threads

  1. I can't show label with textfield
    By LLdeOJ in forum 1.x Help
    Replies: 1
    Last Post: Nov 24, 2010, 10:57 AM
  2. Label Above Textfield in Gridview?
    By Tbaseflug in forum 1.x Help
    Replies: 0
    Last Post: Feb 09, 2010, 3:56 PM
  3. hide textfield label
    By [WP]joju in forum 1.x Help
    Replies: 5
    Last Post: Dec 10, 2009, 11:11 PM
  4. Adding an event to a Label
    By JonG in forum 1.x Help
    Replies: 2
    Last Post: Oct 07, 2009, 9:23 AM
  5. [CLOSED] Can't hide TextField label
    By methode in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 02, 2009, 12:19 PM

Posting Permissions