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
1140
Reg Getting All the Filtered Record into a Dataset in WebDataGrid
posted

Hi,

We need to get all the filtered records in the webdata grid into a dataset for processing the same.

If there are totally around 5000 records and 2000 records that matches particular filters then we need to get those 2000 records into the dataset/datatable irrespective of paging.

Thanks in Advance

  • 16310
    Verified Answer
    Offline posted

    Hello,

    I am currently working to create a sample for you demonstrating how to achieve the required. I will update you by the end of the day. Please let me know if you have other questions in the meantime.

    Hristo

  • 16310
    Offline posted

    Hi Gridhar,

    Please accept my apologies for the late response. You can use the DataFiltered server side event to retrieve the filtered records (irrespective of paging) into a new DataTable:

        protected void WebDataGrid1_DataFiltered(object sender, FilteredEventArgs e)
        {
            var rowFilter = (((DataTable)((WebDataGrid)sender).DataSource).DefaultView).RowFilter;
            DataTable table = ((DataTable)((WebDataGrid)sender).DataSource);
    
            DataView dv = new DataView(table);
            dv.RowFilter = rowFilter;
    
            DataTable filteredTable = dv.ToTable();
            }

    Please find the sample attached and let me know if you have further questions, I will be glad to help.

    Hristo