Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Retrieve LastRow index
posted

Hi,

Is there a way to retrieve the viewing last row index easily?

I able to retrieve the viewing first row index through below code:

int

a = this.ultraGrid1.ActiveRowScrollRegion.VisibleRows.RowScrollRegion.FirstRow.VisibleIndex;

but then i found out that LastRow were a Non public member(pls view the image url below) and I couldnt access to retrieve it.

 

Parents
No Data
Reply
  • 17259
    Offline posted

    You can write instead of:

    hongheng said:
    a = this.ultraGrid1.ActiveRowScrollRegion.VisibleRows.RowScrollRegion.FirstRow.VisibleIndex;

    this:

    this.ultraGrid1.ActiveRowScrollRegion.FirstRow;

    About your question, if the VisibleRows are ordered by index, you could simply write:

    grid.ActiveRowScrollRegion.VisibleRows[grid.ActiveRowScrollRegion.VisibleRows.Count - 1].Row.Index;

    If they are not ordered, you can query the last index:

    grid.ActiveRowScrollRegion.VisibleRows.OfType<VisibleRow>().Max(vr => vr.Row.Index);

Children