views:

2760

answers:

1

I have a radgrid that generates columns dynamically based on user input. Once the grid is populated, the user has the option to export to excel or word. However when the user want's to retain the page formatting, no data is getting exported. But if the user then selects to ignore paging, everything works fine.

So it seems that if the radgrid property "AutoGenerateColumns" is set to false, and "IgnorePaging" is also false, data isn't getting exported.

Anyone else have this problem or am I over looking something?

Here are the methods that configure and call the export:

    private void ConfigureReport(string strExportType)
    {
        switch (strExportType.ToLower())
        {
            case "excel":
                RadGrid1.ExportSettings.FileName = "RadGridExportToExcel";
                break;

            case "word":
                RadGrid1.ExportSettings.FileName = "RadGridExportToWord";
                break;
        }
        RadGrid1.ExportSettings.IgnorePaging = this.cbxPaging.Checked;
        RadGrid1.ExportSettings.ExportOnlyData = this.cbxFormat.Checked;
    }

    private void btnExcel_Click(object sender, EventArgs e)
    {
        if (this.UserProcess.SearchResults != null &&    
            this.UserProcess.SearchResults.Count > 0)
        { 
            ConfigureReport("excel");
            RadGrid1.MasterTableView.ExportToExcel();
        }
        else
        {
            this.lblError.Text = AAILocalization.GetLocaleText("Error:NoResultExport");
        }
    }

Thanks in advance for the help:) Pat

P.S. i've excluded the method that creates the columns for bravity's sake.

A: 

i guess it has something to do with the way you create the columns in code-behind. show more details...

thanks shatrunjay