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
1605
Using UltrawebGrid and UltraWebGridDocumentExporter in code
posted

Hi

I have been using an UltraWebGrid and UltraWebGridDocumentExporter on a web form (ASP.Net 2.0) to export a report in PDF.  To run the report I was directing my execution onto this form.

I would like to now have this functionality called from my code, without having to visit this form.  So I created a .cs class and copied and pasted my code in it.  Because the class does not contain any web controls, I only instantiated them in code like so:

 

 

 

 

UltraWebGrid

 

UltraWebGrid1 = new UltraWebGrid();

 

 

// Set the WebGrid's view type to Hierarchical

UltraWebGrid1.DisplayLayout.ViewType = Infragistics.WebUI.UltraWebGrid.

 

ViewType

.Hierarchical;

 

// Bind the DataSet to the Grid

UltraWebGrid1.DataSource = incidentDataSet.Tables[0];

UltraWebGrid1.DataBind();

 

 

//Now set up the exporter

 

 

UltraWebGridDocumentExporter UltraWebGridDocumentExporter1 = new UltraWebGridDocumentExporter ();

UltraWebGridDocumentExporter1.TargetPaperOrientation = Infragistics.Documents.Report.

 

PageOrientation.Landscape;

UltraWebGridDocumentExporter1.TargetPaperSize = Infragistics.Documents.Report.

PageSizes .A4;

 

...............

---------------

//Export the report

UltraWebGridDocumentExporter1.Export(UltraWebGrid1, s);

When I call the export function on the UltraWebGridDocumentExporter, I get an error:

"object reference not set to an instance of an object"

Can I use the UltraWebGridDocumentExporter as I am?  What can the problem be?

Thanks

Chris

 

 

Parents
No Data
Reply Children
No Data