This is a migrated thread and some comments may be shown as answers.

RadGridView don't show items when RadDataPager resize page data

1 Answer 61 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jose
Top achievements
Rank 1
Jose asked on 18 May 2011, 11:22 PM
I have a RadGridView with a RadDataPager, I put the page size to 0 and then tried to export, the exporting works fine, but when try to set the page size to its original value, the RadGridView doesn't show any elements. However the ItemsCollection has all the elements, and they only appear on the RadGridView when page changing occurs. 

I'm basing my code from the GridView Exporting Paged Data example of your web site Demo.

Please Advise  

Here is an example of my code:

string extension = ((TextBlock)(((System.Windows.Controls.ListBox)btnExport.DropDownContent).SelectedItem)).Text.ToString();

 

            ExportFormat format = ExportFormat.Html;

 

            switch (extension.ToUpper())

            {

                case "HTML":

                    format = ExportFormat.Html;

                    break;

                case "XLS":

                    format = ExportFormat.ExcelML;

                    break;

                case "TXT":

                    format = ExportFormat.Text;

                    break;

                case "CSV":

                    format = ExportFormat.Csv;

                    break;

            }

           

            dialog.DefaultExt = extension;

            dialog.Filter = String.Format("(*.{0})|*.{0}|All files (*.*)|*.*", extension);

            dialog.FilterIndex = 1;

 

            if (dialog.ShowDialog() == true)

            {

                originalPageSize = radDataPager.PageSize;

                originalPageIndex = radDataPager.PageIndex;

                using (Stream stream = dialog.OpenFile())

                {

                    radDataPager.PageSize = 0;

                    GridViewExportOptions exportOptions = new GridViewExportOptions();

                    exportOptions.Format = format;

                    exportOptions.ShowColumnFooters = true;

                    exportOptions.ShowColumnHeaders = true;

                    exportOptions.ShowGroupFooters = true;

                    exportOptions.Items = (IEnumerable)radDataPager.PagedSource;

                    radGrid.Export(stream, exportOptions);

                }

                radDataPager.PageSize = originalPageSize;

                radDataPager.PageIndex = originalPageIndex;

                radGrid.Rebind();

            }

 

1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 20 May 2011, 12:36 PM
Hi Jose,

I have prepared a test project with our latest binaries, utilizing the code you have provided and have never faced such an issue. I am sending it for you reference. Please, have a look at it and inform me whether there are any differences between my approach and yours.

All the best,
Ivan Ivanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Jose
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question
or