Back to Devexpress

ASPxGridView.GetRowLevel(Int32) Method

aspnet-devexpress-dot-web-dot-aspxgridview-dot-getrowlevel-x28-system-dot-int32-x29.md

latest2.8 KB
Original Source

ASPxGridView.GetRowLevel(Int32) Method

Returns the level at which the specified row resides.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public int GetRowLevel(
    int visibleIndex
)
vb
Public Function GetRowLevel(
    visibleIndex As Integer
) As Integer

Parameters

NameTypeDescription
visibleIndexInt32

An integer value that specifies the row’s visible index.

|

Returns

TypeDescription
Int32

An integer value that specifies the level at which the specified row resides.

|

Remarks

Use the GetRowLevel method to identify at which level a group or data row resides.

Example

aspx
<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>
csharp
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

GroupIndex

Grid View

ASPxGridView Class

ASPxGridView Members

DevExpress.Web Namespace