iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
I am getting an error when exporting a grid to xml. All the other export options work fine. The error message is "Cannot change the name of the DataSet to an empty string."
Is there any way to fix this error?
We don't require the XML export option but the error looks bad for the solution so is there any way to hide the XML option or else stop it trying to export to xml in the OnExport event but instead pop up a nice message like "This feature is not supported"
Thanks for your help
FGogan
I have tested the export feature of WebGrid, especially exporting to xml, on my end and on the live sample (http://live.intersoftpt.com/cs/WebGrid/EnableExporting.aspx). During the test, I found no problem at all when exporting WebGrid to xml.
Could you please provide more information regarding the issue so that if it considered as bug, then we can fix it in a fashion time? Or if you have a running simple sample that replicates the issue, it would be so helpful if you could send the sample for further investigation.
In order to customize WebGrid export menu, you can do that on client side by defining new array list in WebGrid ExportTypeList. Below is the snippet of the code that shows how to customize export menu (hide/remove “XML” option from WebGrid export menu).
<script type="text/javascript"> <!-- function WebGrid1_OnInitialize(controlId) { var WebGrid1 = ISGetObject(controlId); WebGrid1.ExportTypeList = new Array("HTML", "PDF", "EXCEL", "TIFF", "RTF", "TEXT"); return true; } --> </script>
Hope this help.
I've removed option to export to XML using your code
Thank you very much
Glad to hear that the script helps.
Should you need further assistance or run into any problems regarding our controls, please feel free to post it in our community. We would be happy to assist you again.
As described in my previous post, I was unable to repro the issue using EnableExporting.aspx reference sample of WebGrid in WebGridSamples project using the latest build of WebGrid 7.0.
Could you please modify the “EnableExporting.aspx” sample so it replicates the issue and then have the sample send back to us for further investigation?
There is a way to recreate the problem. If your data source for the grid is a DataSet then in "DataMember" you are required to identify which table is used as the data for the grid. When you specify DataMember then that name is also the name used in the generated XML element name.
Now change the data source to a collection of objects instead of a DataSet. For an object collection you cannot specify a DataMember in the Grid properties, if you try then you get an error. But that means that the name is now blank, an empty string, and the Grid can't set the XML element name to a blank string. That is what the error message is trying to say.
This has happened for me on Client-side export, I haven't even tried Server-side export but theoretically it should have the same problem.
Options for the developer:
Interesting side note (this has no direct bearing on the problem at hand); using a previous version of the WebGrid, the developers on the project that I am working on found this problem and wrote some horrendous code to side-step the issue. Basically, they assigned the object collection to the datasource of the grid. Next they cast the datasource as a DataSet from the grid back into a new variable (this was possible in the old grid because it would internally build a DataSet from the given object collection). They then set the name property on the first DataTable in the DataSet variable and then rebound the variable to the web grid's data source. It worked for them but the new verion of the grid (quite correctly) doesn't do this automatic DataSet generation so my project can't run using the old kludge on the new WebGrid. I have already removed the kludge because it throws exceptions (and because I really hated it) but that leaves me without an "Export to XML" option for users. They have been told that it had to be removed and might be returned in a future release.
I have decided on option 1 for now, but it would be nice to have the XML functionality in the future.
HTH to find the issue (perhaps there should be a default behaviour so that if the DataMember is blank then default to something else for an element name for the XML output ... like the grid's name ... or "Data" ... or the page name ... or allow the developer to provide a DataMember name for object collection data sources for the sole reason of XML support).
I have attached an example project. in the "wgResults_InitializeDataSource" event handler, uncomment each of the options to try them out.
When setting the DataMember on the grid, it must be changed on the web grid and on the root table at the same time.
The initial configuration is for an object collection example. All exports work except XML.
Change the configuration for DataSet example and you will see that all exports work including XML.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname