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
We have a webgrid view using the setting below:
<ISWebGrid:WebGrid ID="WebGrid1" runat="server" Height="500px" UseDefaultStyle="True" Width="1000px" OnExport="WebGrid1_Export" DefaultStyleMode="Elegant" DataCacheStorage="Session" OnInitializeDataSource ="WebGrid1_InitializeDataSource" OnPrepareDataBinding="WebGrid1_PrepareDataBinding" OnCustomAggregate="WebGrid1_CustomAggregate"> <LayoutSettings PagingMode="VirtualLoad" VirtualLoadMode="LargeData" AllowExport="Yes" PagingExportMode="ExportAllData" AllowFilter="Yes" AllowSorting="Yes" ColumnFooters="Yes"> </LayoutSettings>
And we use server side data binding instead of client side binding at the desginer. However when we try to export the data after we do filter, the part which is underlined returns null value and the system crashes.
protected void WebGrid1_Export(object sender, ISNet.WebUI.WebGrid.ExportEventArgs e)
{ e.Table.Rows.Clear(); DataRowCollection rows = (WebGrid1.DataSourceManager.CurrentDataSource as System.Data.DataView).ToTable().Rows; foreach (DataRow row in rows) { var wgRow = e.Table.CreateRow(); foreach (WebGridColumn col in e.Table.Columns) { if (!col.IsRowChecker) { wgRow.Cells.GetNamedItem(col.Name).Value = row[col.DataMember]; wgRow.Cells.GetNamedItem(col.Name).Text = wgRow.Cells.GetNamedItem(col.Name).Value.ToString(); } } e.Table.Rows.Add(wgRow); } }
Try to replace WebGrid1.DataSourceManager.CurrentDataSource with e.DataSource. The OnExport event-handler will look like following after changes:
protected void WebGrid1_Export1(object sender, ExportEventArgs e) { e.Table.Rows.Clear(); DataRowCollection rows = (e.DataSource as System.Data.DataView).ToTable().Rows; foreach (DataRow row in rows) { var wgRow = e.Table.CreateRow(); foreach (WebGridColumn col in e.Table.Columns) { if (!col.IsRowChecker) { wgRow.Cells.GetNamedItem(col.Name).Value = row[col.DataMember]; wgRow.Cells.GetNamedItem(col.Name).Text = wgRow.Cells.GetNamedItem(col.Name).Value.ToString(); } } e.Table.Rows.Add(wgRow); } }
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