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

[Solved] options for exporting all data or only paged data

3 Answers 82 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.
Rick Mueller
Top achievements
Rank 1
Rick Mueller asked on 14 Dec 2010, 08:18 PM
Hello,
Using telerik example on exporting data for a grid, I want the user to be able to choose "All Data" or only Page Data".

No errors show up but it doesn't fire.  Code:
  if (dialog.ShowDialog() == true)
    {
        using (Stream stream = dialog.OpenFile())
        {
            int originalPageSize = radDataPager1.PageSize;
            int originalPageIndex = radDataPager1.PageIndex;
            RadioButton rb = (RadioButton)exppage.IsChecked;
            if (rb == true)
            {
                radDataPager1.Page = "0";
                GridViewExportOptions export = new GridViewExportOptions();
                export.Format = format;
                export.ShowColumnFooters = true;
                export.ShowColumnHeaders = true;
                export.ShowGroupFooters = true;
                RadGridView1.Export(stream, export);
            }
            else
                radDataPager1.PageSize = originalPageSize;
            radDataPager1.PageIndex = originalPageIndex;
            GridViewExportOptions exportOptions = new GridViewExportOptions();
            exportOptions.Format = format;
            exportOptions.ShowColumnFooters = true;
            exportOptions.ShowColumnHeaders = true;
            exportOptions.ShowGroupFooters = true;
            RadGridView1.Export(stream, exportOptions);
        }
    }
}
Please any thoughts?

regards,
Rick

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 15 Dec 2010, 08:12 AM
Hi,

 Can you post more info what exactly does not work? SaveFileDialog or the exporting itself? 

All the best,
Vlad
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Rick Mueller
Top achievements
Rank 1
answered on 15 Dec 2010, 03:44 PM
Hello,
Sorry about the details, Its not exporting.

Regards,
Rick
0
Veselin Vasilev
Telerik team
answered on 16 Dec 2010, 10:18 AM
Hi Rick Mueller,

Looking at your code I found this line:

if (rb == true)
            {
                radDataPager1.Page = "0";

RadDataPager does not have a property Page of type string. Please use PageSize which is of type integer.

if (rb == true)
            {
                radDataPager1.PageSize = 0;

You can check our online demo for a reference.

All the best,
Veselin Vasilev
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
GridView
Asked by
Rick Mueller
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Rick Mueller
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or