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

Reverting the Export setting on a grid

6 Answers 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 06 Jul 2009, 02:12 PM
Hi,

So I have a grid that I export the data on, this all works fine but if a user goes back to use the grid the settings that have been set for the export effect the grid, particularly the ExportOnlyData filter which is hiding quite alot of the data in the grid when the user goes back and expands any of the hierarchy or orders the grid etc?

This is my current export:

With rgProjectSearch 
            .ExportSettings.FileName = "ProjectSearch" & Now.Date.ToShortDateString.Replace("/"""
            .ExportSettings.ExportOnlyData = True 
            .ExportSettings.IgnorePaging = True 
            .ExportSettings.OpenInNewWindow = True 
            .ExportSettings.Excel.Format = Telerik.Web.UI.GridExcelExportFormat.ExcelML 
            .Columns.FindByUniqueName("ProjectResearchTitle").Visible = True 
            .Columns.FindByUniqueName("ClockStatusID").Visible = False 
            .MasterTableView.ExportToExcel() 
        End With 

I have tried to revert the settings after the ExportToExcel has run but it seems to run this command at the very end anyway, presumably because of the asynchonous AJAX.  Is there anyway to revert these settings once the export has been run, even if it is on an action?


6 Answers, 1 is accepted

Sort by
0
Steven
Top achievements
Rank 1
answered on 07 Jul 2009, 02:21 PM
I tried to reset these settings in the RadGrid_DetailTableDatabind as that is run when they expand the hierarchy but it just errors out.  Anyone have any other ideas how to resolve this?
0
Pavlina
Telerik team
answered on 09 Jul 2009, 11:26 AM
Hi Steven,

I am sending you a simple working project which handles the desired functionality. Please give it a try and let me know if this is the expected behavior.

Sincerely yours,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Steven
Top achievements
Rank 1
answered on 09 Jul 2009, 01:00 PM
Hi Pavlina,

Thanks for the response but this doesn't do anything that I am not already doing, I know how to show the expanded sections, that isn't the problem.

When I use the export routine:

Protected Sub btnExcel_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles btnExcel.Click 
        gvDevices.MasterTableView.HierarchyDefaultExpanded = cbExportOptions.Checked 
 
        gvDevices.ExportSettings.ExportOnlyData = True 
        gvDevices.ExportSettings.FileName = "Device data for " & hfLocationString.Value & " at " & Format(Now, "dd-MMM-yy hh-mm-ss"
        gvDevices.ExportSettings.IgnorePaging = True 
        gvDevices.ExportSettings.OpenInNewWindow = True 
        gvDevices.MasterTableView.ExportToExcel() 
    End Sub 

This affects the grid on the page.  For instance any GridHyperLinkColumn will hide any data in the grid if I set ExportOnlyData = True, as soon as a user manipulates the grid in anyway, any of the settings set when the report was run still persist:

Before I ran the report: unexpanded.gif

I then run a report, close the report then I go back to the grid and expand one of the records to show the hierarchy and it changes the appearance of the grid.

When I expand the grid: expanded.gif

On the second image you can see all the links have been removed from the first column, this also occurs with all link fields in the MainDetailTable.  If I add the command to expand all hierarchy in the grid for the report when I come back to reuse the grid, if for instance I open one of the records then they all open as this was set when I ran the report.

What I need to know is where/how/when I can reset the settings I specified when the report was generated so it doesn't alter the appearance of the grid if the user wants to keep using it?

I hope that makes sense,

Steve

0
Pavlina
Telerik team
answered on 09 Jul 2009, 03:06 PM
Hello Steven,

I am afraid that the provided information is not enough to determine what have caused the unexpected behavior. At this point I will ask you to open a formal support ticket and send us a simple running project (incl. CSS, images, skins, DB backup if needed and so on) demonstrating the problem (and step-by-step instructions on doing so). In that way we can reproduce and pinpoint the problems you're facing on our side, understand the logic of your application and provide a solution.

Best wishes,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Steven
Top achievements
Rank 1
answered on 09 Jul 2009, 03:35 PM
If you just add this column to the code you sent me earlier:

                            <telerik:GridHyperLinkColumn  
                                DataTextFormatString="{0}" 
                                UniqueName="OrderIDLink"  
                                DataNavigateUrlFormatString="projectInformation.aspx" 
                                HeaderText="OrderIDLink"  
                                DataTextField="OrderID" 
                                SortExpression="OrderID" 
                                ItemStyle-BackColor="#EDE6E6"
                            </telerik:GridHyperLinkColumn> 

You can clearly see that when you run the export that it has an effect on the grid.  If you run that project with this link column after you have exported the data the links will be removed entirely from the grid if you expand or collapse any of the hierarchy.  Also an even easier test to see what is happening is if you set one of the columns to be hidden when you export:

Protected Sub btnExcel_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles btnExcel.Click 
        gvDevices.MasterTableView.HierarchyDefaultExpanded = cbExportOptions.Checked 
 
        gvDevices.ExportSettings.ExportOnlyData = True 
        gvDevices.ExportSettings.FileName = "Device data for " & hfLocationString.Value & " at " & Format(Now, "dd-MMM-yy hh-mm-ss"
        gvDevices.ExportSettings.IgnorePaging = True 
        gvDevices.ExportSettings.OpenInNewWindow = True 
 
        'HIDE COLUMN FROM EXPORT 
        gvDevices.Columns.FindByUniqueName("OrderID").Visible = False 
 
        gvDevices.MasterTableView.ExportToExcel() 
    End Sub 

This column will be then be hidden from the grid if you expand any of the hierarchy. 

Surely there is a simple process to revert these changes once the export has been run, I find it hard to believe no one has encountered this before?


0
Pavlina
Telerik team
answered on 13 Jul 2009, 05:14 PM
Hi Steven,

The question set forth has been addressed in the support ticket, which you have opened on the matter. To avoid duplicate posts, we can continue our communication there.

All the best,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Steven
Top achievements
Rank 1
Answers by
Steven
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or