Dear sir:
I have asp.net page with a ultragrid with band 0 and band 1 . it work fine for data display. the band 1 is used load on demand = manual. i tried to export the grid to the excel with ultrawebgridexcelexporter control to export the data to excel but the band 1 is missing..... is there any way or sample to export both band0 and band 1?
best regards
From Edmond LUI
WebGridExcelExporter will export to Excel those rows in the grid that have been loaded. Thus, if you have three parent rows and expand the first two (to load their child data) before you export, you'll get child data for those parent rows but not for the third.
This is the same reason why the Excel exporter only grabs the current WebGrid page (if paging is used), or only the first RowsRange worth of data (if the grid's AJAX functionality is used).
To ensure that all rows are included in your export, I advise turning off load-on-demand (use a value of "NotSet" for DisplayLayout.LoadOnDemand). Instead, bind the grid so that it load alls data, at all levels. You can do this during right before you call Export() on the Excel exporter. Since you're using manual load-on-demand, this may require that you have access to a method or other process that allows you to get at all available data, rather than one data island at a time.
Generally, so long as you're using the standard download mode, where the response sent to the browser is the Excel file itself, you don't even need to re-bind your grid to its original data. This is because none of the changes should be persisted in any way, such as in ViewState; the client never gets any notification that a change was made. By comparison, if you use a custom download mode or if you persist changes in some way (such as in Session state), you'll likely need to restore the state of your grid to where it was before you exported.
Thks for you explaination
I tried to set the DisplayLayout.LoadOnDemand = LoadOnDemand.NotSet but the child row still not appear (even i expand the sub band). my code is below
if (Request.Form["uniqueKey"] != null) { if (Session["Unit_DataSet" + Session.SessionID + "_" + Request.Form["uniqueKey"].ToString()] != null) { ds = (DataSet)Session["Unit_DataSet" + Session.SessionID + "_" + Request.Form["uniqueKey"].ToString()]; }
} this.UltraWebGrid1.DisplayLayout.Pager.AllowPaging = false; this.UltraWebGrid1.DisplayLayout.LoadOnDemand = LoadOnDemand.NotSet; this.UltraWebGrid1.DataSource = ds; this.UltraWebGrid1.DataBind();
//Export the data switch (this.Request.QueryString["ExportFormat"].ToString()) { case "Excel": this.UltraWebGridExcelExporter1.Export(this.UltraWebGrid1); break;
}
Thank you for your help!!!
From Edmond
edl0022 said:even i expand the sub band
If you expanded the parent row using the UI on the browser, then I don't believe the result you're seeing should be expected. If you confirm that this is what you're doing, I'll pass this to Developer Support for further research.
If you expanded the parent row programmatically on the server, then this is an expected result. Expanding a parent row programmatically on the server does not cause the DemandLoad event to be raised or for child rows to be populated. The programmer would need to manually populate the child rows explicitly in this case. My suggestion in this case is to bind to a data source that contains all the data at all levels, rather than data that is "optimized" for manual load-on-demand usage.
Thks for you kindly reply:
I did expand the sub band by UI but the exported excell is not show the sub band.....so is there any more reference so i can try or follow?
This isn't the behavior I'd expect. Your situation requires more in-depth research than we can provide over the forums, so I suggest we get this over to Developer Support.
Can you reproduce this behavior in an isolated sample project that we can run and debug? If so, then you can either submit a support request directly, attachng your project to the request and mentioning a link to this forum thread, or you can post the project here and I'll pass this over to Developer Support to have a case created. Submitting the support request directly will help us to get you a response more quickly.
got exactly the same problem.
two bands, all expanded (ExpandAll(true), an ExcelExporter, but no second-level band is exported. I don't use demandLoad and all row are filled on databind
I'm using infragistics 7.3.
bobbo601,
Are you using the latest service release of NetAdavntage for .NET 2007 Volume 3? If not, I suggest that you download it from the My Keys and Downloads page and test your issue using the service release. This version is no longer actively maintained, so there are no new bug fixes being released for this version.
If the issue still occurs there, I recommend next that you test using our latest version, NetAdvantage for .NET 2009 Volume 1. You can use a trial version if you don't already have a key for it.
If the issue can still be reproduced in our latest release version, can you reproduce this behavior in a sample project that we can run and debug? If so, then please submit a support request and attach your sample, so that a Developer Support Engineer can investigate.