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
380
ScrollBar
posted

My Grid is having 100+ records,to view particular type of records we will be giving the filter criteria and the records will be retrieved and when we remove the filter criteria,Scrolllbar will be at the records that are retrieved for that filter criteria,but i want the scrollbar to the top of the grid.

So i added the code in Ultragrid_filterrow event to make the scrollbar at the top of the grid,but filterrow event is called even i am scrolling on the grid.

Please advise.

Thanks

  • 469350
    Offline posted

    Hi,

    FilterRow is called for each row to determine whether that row is filtered or not. So you cannot use that event.

    Also, the grid filtering is done asynchronously by default. So there's really no way to do what you want here without making some changes.

    I'm a little confused by your question, though. I tried this out and every time I filter the grid, it scrolls all the way to the top, anyway. Maybe I am missing something or my sample is different from yours in some way.

    If you only have about 100 rows in the grid, then you could probably get away with changing the filtering to by synchronous without any noticeable performance hit.

    To make the filtering synchronous, you handle the BeforeRowFilterChanged event and set the ProcessMode.


            private void ultraGrid1_BeforeRowFilterChanged(object sender, BeforeRowFilterChangedEventArgs e)
            {
                e.ProcessMode = ProcessMode.Synchronous;
            }

            private void ultraGrid1_AfterRowFilterChanged(object sender, AfterRowFilterChangedEventArgs e)
            {
                UltraGrid grid = (UltraGrid)sender;
                grid.ActiveRowScrollRegion.ScrollPosition = 0;
            }