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
965
NoRowsInDataSourceMessageEnabled and VisibleRowCount
posted

Hello,

I am considering using the new NoRowsInDataSourceMessageEnabled  in 12.1.

In our application we are using the VisibleRowCount to show how many rows are in a grid. I noticed when no rows are returned and NoRowsInDataSourceMessageEnabled  = true. The Message is considered a Row so I am getting a VisibleRowCount of 1.

Is there a way to exclude the Message so the VisibleRowCount  will return 0 like it does when this property is not enabled.

Thank You

  • 48586
    Verified Answer
    posted

    Hello,

     

    VisibleRowCount property returns the total number of visible rows in the collection. If the template add-row is visible, this property's return value will include that as well even though the template add-rows are not part of the collection, they are visible. So it is expected the message to be considered as a row. However you could use Count method of the Rows collection, in order to get the number of the DataRow, which are  not filtered out and are not hidden. You could use code like:

     

    Int visibleRowCount = ultraGrid1.Rows.Count(row => row.IsDataRow && !row.IsFilteredOut && !row.Hidden);

     

    Please let me know if you have any further questions.