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
Hi Team,
I have webgrid with rowchecker on it, and I have property AllowExport yes. What I want is when I do export to let say excel file, I want only selected data (picked from rowchecker) to be export. Could you guys give me a simple sample that show how it works? Immediate response will be appreciated.
Best Regards,
- Indah -
WebGrid has OnExport server-side event that occurs when exporting data from WebGrid is performed. The event handler receives an argument of type ExportEventArgs containing data related to this event One of the ExportEventArgs property is the “Table” property.
The “Table” property gets or sets the structure of table used by the event. We can utilize this property so that only checked rows that are going to be exported.
The snippet code below shows how to implement such scenario on a simple single-level WebGrid.
protected void WebGrid1_Export(object sender, ISNet.WebUI.WebGrid.ExportEventArgs e) { // get the total rows in the root table of WebGrid int totalRows = WebGrid1.RootTable.Rows.Count; for (int i = 0; i < totalRows; i++) { // get the number of checked rows int checkedRowsCount = WebGrid1.RootTable.GetCheckedRows().Count; // a flag that shows whether row is match to one of the rows in the checked rows bool IsMatch = false; foreach (string keyValue in WebGrid1.RootTable.GetCheckedRows()) { // if current row is equal to one of the rows in the checked rows // then break if (e.Table.Rows[i].KeyValue.ToString() == keyValue) { IsMatch = true; break; } } // if current row is equal to one of the rows in the checked rows // then passes to the next iteration // else remove current row if (IsMatch) continue; else { e.Table.Rows.RemoveAt(i); i--; totalRows--; } } // set the "IsRowChecker" to be not visible during export e.Table.Columns.GetNamedItem("IsRowChecker").Visible = false; }
A simple sample is enclosed as attachment. Please have the sample tested on your end and kindly let us know whether it helps or not.
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