Dec 19, 2012, 1:24 AM
[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]