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
55
Exporting a class that implements Ultrawebgrid
posted

VS2008, ASP.net 3.5

 In my project I've created an enhancedwebgrid class that implements ultrawebgrid, it adds a handful of properties, and overrides render and on databound, the render override just adds a string "Found X results" and the databound one adds a default column.

The problem arises when I try to export using the ultrawebgrid.documentexporter, I receive a nullreferenceexception.

Here's an image of the exceptiion exception picture

The text of the stack trace is...

    at Infragistics.WebUI.UltraWebGrid.DocumentExport.UltraWebGridDocumentExporter.Export(UltraWebGrid grid, ISection section)
   at Infragistics.WebUI.UltraWebGrid.DocumentExport.UltraWebGridDocumentExporter.Export(UltraWebGrid grid, Report report)
   at Infragistics.WebUI.UltraWebGrid.DocumentExport.UltraWebGridDocumentExporter.Export(UltraWebGrid grid)
   at CustomWebGrid.ButtonExport_Click(Object sender, EventArgs e) in CustomWebGrid.ascx.cs:line 184
   at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
   at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 

 

The code in question is..

            var exporter = new UltraWebGridDocumentExporter();            
            exporter.Format = FileFormat.PlainText;
            exporter.TargetPaperOrientation = PageOrientation.Landscape;
            exporter.DownloadName = "report.txt";
            exporter.ExportMode = Infragistics.WebUI.UltraWebGrid.Exporter.ExportMode.InBrowser;
            exporter.DataExportMode = DataExportMode.DataInGridOnly;            
            
            exporter.Export((UltraWebGrid)EnhancedWebGrid1);

 I've tried leaving off the DataExportMode, using PDF and XPS formats, although that made no difference.

I also tried on the fly creating a new UltraWebGrid (the base class mine implements) and setting it's datasourceID to the dataobject I use for the other webgrid and calling export on that to see if I can get anything to appear, I receive the same error, as well as for a new Webgrid with no datasource specified.

I've debugged and verified that the webgrid I'm sending in has data, it's not being lost due to postbacks or anything like that, I'm open to suggestions/ideas.