[CLOSED] DisplayField word wrap alignment

  1. #1

    [CLOSED] DisplayField word wrap alignment

    When I create the DisplayField in code behind and the text value is large the string is wrapped, but center align. Where if I create it in markup it is wrapped and left justified.

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html >
    <html>
    <script runat="server">
        protected void TestClick(object sender, DirectEventArgs e)
        {
            Notification.Show(new NotificationConfig
            {
                Title = "DisplayField BehindCode issue",
                BodyStyle = "height: auto",
                Width = 350,
                Draggable = true,
                ShowPin = true,
                Pinned = true,
                AlignCfg = new NotificationAlignConfig
                {
                    El = ((Ext.Net.Button)sender).ConfigID,
                    ElementAnchor = AnchorPoint.TopLeft,
                    TargetAnchor = AnchorPoint.BottomRight,
                    OffsetX = 5,
                    OffsetY = -10,
                },
                Items =
                {
                    new Ext.Net.FormPanel
                    {
                        BodyPadding = 2,
                        Border = false,
                        FieldDefaults = {LabelAlign=LabelAlign.Right, LabelWidth=50},
                        Defaults = {new Ext.Net.Parameter ("margin", "2 0 2 0", Ext.Net.ParameterMode.Value)},
                        Items =
                        {
                            new Ext.Net.DisplayField {FieldLabel="Label01", Text="Text01"},
                            new Ext.Net.DisplayField {FieldLabel="Label02", Text="This is a very long text string.  In the behind code the string does not wrap correctly."},
                         
                        }
                    }
                }
            });
        }
    </script>
    <head runat="server">
        <title></title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:FormPanel runat="server" Width="380" BodyPadding="2" Border="false">
            <FieldDefaults LabelAlign="Right" LabelWidth="50" />
            <Defaults>
                <ext:Parameter Name="margin" Value="2 0 2 0" Mode="Value" />
            </Defaults>
            <Items>
                <ext:DisplayField runat="server" FieldLabel="Label01" Text="Text01" />
                <ext:DisplayField runat="server" FieldLabel="Label02" Text="This is a very long text string.  In the markup code the string wraps correctly." />
                <ext:Button runat="server" Text="Test" OnDirectClick="TestClick" />
            </Items>
        </ext:FormPanel>
    </body>
    </html>
    Last edited by Daniil; Dec 19, 2012 at 4:01 PM. Reason: [CLOSED]
  2. #2
    Hi Chris,

    Notification centers the text. There is such default CSS rule.

    This
    BodyStyle = "height: auto; text-align: left;"
    makes the text left-aligned.
  3. #3
    For me everything looks like ok. Am i missing something?

    Click image for larger version. 

Name:	example02.png 
Views:	141 
Size:	40.2 KB 
ID:	5287

    Note: I tested against Ext.NET Pro 2.1 for ASP.NET WebForms relased on 2012-12-11
  4. #4
    Please close the thread.

    I am executing against the latest version of the trunk (Rev 4685 [Dec 18, 2012], using Chrome 23.0.1271.97) without the modification to BodyStyle the Displayfield with long text in the notification box is still centered.

    Click image for larger version. 

Name:	DisplayField.JPG 
Views:	99 
Size:	23.3 KB 
ID:	5289

    I have no problem adding the "text-align: left;" to the BodyStyle, but I am confused why the first DisplyField text "Text01" is not centered. It does not seem consistent.

    EDIT: OK, inspecting the elements via the browser both the DisplayFields text elements are centered but the width is the exact size needed (text01 = 40px, Text02 = 272px). So I will just add the "text-align: left;" to the BodyStyle of my notification.
    Last edited by cwolcott; Dec 19, 2012 at 12:28 PM.
  5. #5
    Quote Originally Posted by RCN View Post
    For me everything looks like ok. Am i missing something?

    Click image for larger version. 

Name:	example02.png 
Views:	141 
Size:	40.2 KB 
ID:	5287

    Note: I tested against Ext.NET Pro 2.1 for ASP.NET WebForms relased on 2012-12-11
    This rule appeared after the 2.1 release. Previously, it was applied via the HTML style attribute.

    Quote Originally Posted by cwolcott View Post
    EDIT: OK, inspecting the elements via the browser both the DisplayFields text elements are centered but the width is the exact size needed (text01 = 40px, Text02 = 272px). So I will just add the "text-align: left;" to the BodyStyle of my notification.
    You were ahead of me:)
  6. #6
    Thanks. Go ahead and close the thread.

Similar Threads

  1. Use a Word document
    By Coroner in forum 1.x Help
    Replies: 1
    Last Post: Jun 28, 2012, 9:33 PM
  2. [CLOSED] Ext.net 2v Beta Release: DisplayField don't wrap text.
    By supera in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Mar 26, 2012, 3:08 PM
  3. Word File preview way
    By gayancc in forum 1.x Help
    Replies: 2
    Last Post: Nov 12, 2011, 5:44 PM
  4. copy paste from ms word
    By [WP]joju in forum 1.x Help
    Replies: 0
    Last Post: Aug 20, 2010, 7:30 AM
  5. Any word on MVC sample?
    By UGRev in forum Open Discussions
    Replies: 14
    Last Post: Apr 06, 2009, 4:24 PM

Posting Permissions