View Full Version : [CLOSED] DisplayField with multiple fields

Jan 30, 2013, 8:57 PM

We set up a read only form to display customer information like this using DisplayFields:

Name: Joe
Address: 1234 Main
City: Portland
State: OR
Zip: 98000

<ext:DisplayField ID="CustomerName" runat="server" FieldLabel="Name" LabelAlign="Right"/>
<ext:DisplayField ID="CustomerNumber" runat="server" FieldLabel="Number" LabelAlign="Right"/>
<ext:DisplayField ID="Address" runat="server" FieldLabel="Address" LabelAlign="Right"/>
<ext:DisplayField ID="City" runat="server" FieldLabel="City" LabelAlign="Right"/>
<ext:DisplayField ID="State" runat="server" FieldLabel="State" LabelAlign="Right"/>
<ext:DisplayField ID="Zip" runat="server" FieldLabel="Zip" LabelAlign="Right"/>

But we want to display it like this
Name: Joe
Address: 1234 Main Portland, OR 98000

What object type should I use for accomplishing this and do you have a link to an example that combines multiple fields into one?

Thank you for your help.

Jan 30, 2013, 10:14 PM

Try to use FieldContainer: http://examples2.ext.net/#/Form/FieldContainer/Overview/

Feb 01, 2013, 8:32 AM
Thank you Baidaly for responding so quickly! I had seen that example but wasnt sure if it would help. I dug in a bit deeper after your suggestion and got it work. However, the combined text does not line up "quite" right like it does for the other fields where I am only using one value. Also, sometimes, sporadically, the text would all pile on top of each other rather than display as a single string.

I went with returning an additional field from our model that has all the fields combined into a single field.

Thank you again for your help.

Feb 01, 2013, 10:42 AM
If you will have a chance and time to provide us with a sample to reproduce the issue you are talking about, we would be happy to investigate.

Feb 01, 2013, 8:32 PM
Hello Danil, below is an example:
Two things occur
1) The text next to Address is lower relative to its label than Cust Number and Email are relative to their labels. I can almost fix it playing around with MarginSpecs and such but only get it close to the same alignment as Email Address and Cust Number.
2) The text for Address is collapsed on top of each other.

Note: I tested this in IE, FF, Chrome

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Collections.Generic"%>
<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
FormPanel2.SetValues(new {
Email = "henry@example.com",
FirstName = "Henry",
LastName = "Example",
CustNumber = "6755499",
Address = "1234 Main",
City = "Portland",
State = "OR",
Zip = "90000",
<!DOCTYPE html>
<head id="Head1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
ID="FormPanel2" runat="server">
<ext:DisplayField ID="TextField18"
FieldLabel="Email Address"
<ext:DisplayField ID="DisplayField1"
FieldLabel="Cust Number"
<ext:FieldContainer ID="FieldContainer1" runat="server" CombineErrors="true" MsgTarget="Under" Layout="HBoxLayout" FieldLabel="Address" LabelAlign="Right" >
<ext:Parameter Name="HideLabel" Value="true" Mode="Raw" />
<ext:Parameter Name="margins" Value="0 5 0 0" Mode="Value" />
<ext:DisplayField ID="Address" runat="server" />
<ext:DisplayField ID="DisplayField2" runat="server" Text="&nbsp;" />
<ext:DisplayField ID="City" runat="server" />
<ext:DisplayField ID="DisplayField3" runat="server" Text=",&nbsp;" />
<ext:DisplayField ID="State" runat="server" />
<ext:DisplayField ID="DisplayField4" runat="server" Text="&nbsp;" />
<ext:DisplayField ID="Zip" runat="server" />

Feb 01, 2013, 10:03 PM

Sorry, I didn't see anything wrong in your example. I've tried with the last trunk revision.