aspnet-devexpress-dot-web-dot-aspxgridview-dot-getrowlevel-x28-system-dot-int32-x29.md
Returns the level at which the specified row resides.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public int GetRowLevel(
int visibleIndex
)
Public Function GetRowLevel(
visibleIndex As Integer
) As Integer
| Name | Type | Description |
|---|---|---|
| visibleIndex | Int32 |
An integer value that specifies the row’s visible index.
|
| Type | Description |
|---|---|
| Int32 |
An integer value that specifies the level at which the specified row resides.
|
Use the GetRowLevel method to identify at which level a group or data row resides.
<dx:ASPxGridView ID="ASPxGridView1" runat="server" OnSummaryDisplayText="ASPxGridView1_SummaryDisplayText">
<Settings ShowGroupPanel="true" ShowFooter="True" ShowGroupFooter="VisibleIfExpanded"/>
<Columns>
...
</Columns>
<GroupSummary>
<dx:ASPxSummaryItem FieldName="UnitPrice" ShowInGroupFooterColumn="UnitPrice" SummaryType="Count" />
</GroupSummary>
</dx:ASPxGridView>
protected void ASPxGridView1_SummaryDisplayText(object sender, ASPxGridViewSummaryDisplayTextEventArgs e) {
if (e.IsGroupSummary) {
int level = ASPxGridView1.GetRowLevel(e.VisibleIndex);
switch (level) {
case 0:
e.Text = String.Format("<span style='color:red'>{0}</span>", e.Value);
break;
case 1:
e.Text = String.Format("<span style='color:green'>{0}</span>", e.Value);
break;
case 2:
e.Text = String.Format("<span style='color:blue'>{0}</span>", e.Value);
break;
default:
break;
}
}
}
See Also