ASPxGridSummaryDisplayTextEventArgs.Text Property
Gets or sets the display text for the summary value currently being processed.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v18.2.dll
Declaration
Property Value
Type | Description |
---|---|
String | A String value that specifies the summary value’s display text. |
Remarks
Initially, the Text property contains the text currently displayed in the summary. To provide custom text, assign it to the Text property.
Use the ASPxGridSummaryDisplayTextEventArgs.Value property to get the processed summary value.
Example
The following example illustrates how to use the Text property.
WebForms approach:
Note
For a full example, refer to the How to implement summary whose value depends upon an external editor value online example.
<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False"
ClientInstanceName="grid" DataSourceId="AccessDataSource1" KeyFieldName="CategoryID"
OnSummaryDisplayText="ASPxGridView1_SummaryDisplayText" Width="552px">
<Settings ShowFooter="True"></Settings>
<TotalSummary>
<dx:ASPxSummaryItem SummaryType="Sum" FieldName="CategoryID" ShowInColumn="CategoryID"></dxwgv:ASPxSummaryItem>
</TotalSummary>
<Columns>
<dx:GridViewDataTextColumn FieldName="CategoryID" ReadOnly="True" VisibleIndex="0">
<EditFormSettings Visible="False"></EditFormSettings>
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="CategoryName" VisibleIndex="1"></dxwgv:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Description" VisibleIndex="2"></dxwgv:GridViewDataTextColumn>
</Columns>
</dx:ASPxGridView>
MVC approach:
Note
For a full example, refer to the How to provide custom summary texts within GridView online example.
Html.DevExpress().GridView(settings => {
settings.Name = "dxGridView";
...
settings.GroupSummary.Add(DevExpress.Data.SummaryItemType.Count, "ShipName");
settings.TotalSummary.Add(DevExpress.Data.SummaryItemType.Sum, "UnitPrice").DisplayFormat = "c";
settings.SummaryDisplayText = (sender, e) => {
if(e.Item.FieldName == "UnitPrice")
e.Text = string.Format("Sum of unit price: ${0}", Convert.ToDouble(e.Value));
if(e.Item.FieldName == "ShipName")
e.Text = string.Format("Count of records: {0}", Convert.ToDouble(e.Value));
};
})
.Bind(Model)
.Render();
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Text property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.