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
How can we export data which is different from the data binded to the webgrid ?
You can try to use the following steps in order to export custom data which is different from the data binded to WebGrid:
The snippet code below shows how.
protected void Button1_Click(object sender, EventArgs e) { // Step 2: rebind the custom data source dsNorthwind_ReadOnlyTableAdapters.ShippersTableAdapter daCustomDataSource = new dsNorthwind_ReadOnlyTableAdapters.ShippersTableAdapter(); WebGrid1.DataSource = daCustomDataSource.GetData(); // set WebGrid's DataSource WebGrid1.RetrieveStructure(); WebGrid1.RebindDataSource(); // Step 3: invoke the Export Grid feature WebGrid1.ExportGrid(SetDynInfo()); // export grid data // Step 4: rebind the original data source dsNorthwind_ReadOnlyTableAdapters.ProductsTableAdapter daOriginalDataSource = new dsNorthwind_ReadOnlyTableAdapters.ProductsTableAdapter(); WebGrid1.DataSource = daOriginalDataSource.GetData(); // set WebGrid's DataSource WebGrid1.RetrieveStructure(); WebGrid1.RebindDataSource(); } private DynARInfo SetDynInfo() { // configure the DynARInfo object // as the parameter for the ExportGrid() method // need to configure 4 things : // dynInfo.ReportType // dynInfo.ReportPath // dynInfo.IISReportPath // dynInfo.DynPageOrientation DynARInfo dynInfo = new DynARInfo("excel", Server.MapPath("~/TempReports/"), "WebGridToExcel"); dynInfo.IISReportPath = "/TempReports/"; dynInfo.DynPageOrientation = PageOrientation.Portrait; return dynInfo; }
WebGrid will show Products table. When the button is clicked, Shippers table will be exported.
Hope this helps.
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