﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - Web Grid cannot export filtered data in virtual load mode and server side binding</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Web-Grid-cannot-export-filtered-data-in-virtual-load-mode-and-server-side-binding/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Web Grid cannot export filtered data in virtual load mode and server side binding</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Web-Grid-cannot-export-filtered-data-in-virtual-load-mode-and-server-side-binding/</link><pubDate>Fri, 25 Nov 2016 07:50:26 GMT</pubDate><dc:creator>yudi</dc:creator><category>WebGrid</category><category>bug webgrid</category><description>&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Try to replace WebGrid1.DataSourceManager.CurrentDataSource with e.DataSource. The OnExport event-handler will look like following after changes:&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;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);
    }
}&lt;/pre&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Web Grid cannot export filtered data in virtual load mode and server side binding</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Web-Grid-cannot-export-filtered-data-in-virtual-load-mode-and-server-side-binding/</link><pubDate>Tue, 15 Nov 2016 04:13:31 GMT</pubDate><dc:creator>GUSDIANTO@apb.com.sg</dc:creator><category>WebGrid</category><category>bug webgrid</category><description>&lt;p&gt;We have a webgrid view using the setting below:&lt;/p&gt;&lt;pre&gt;        &amp;lt;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"&amp;gt;
                 &amp;lt;LayoutSettings PagingMode="VirtualLoad" VirtualLoadMode="LargeData"
                    AllowExport="Yes" PagingExportMode="ExportAllData"
                    AllowFilter="Yes" AllowSorting="Yes" ColumnFooters="Yes"&amp;gt;
                &amp;lt;/LayoutSettings&amp;gt;&lt;/pre&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;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.&lt;span style="background-color: rgb(255, 252, 225); font-family: &amp;quot;Courier New&amp;quot;, Tahoma; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: rgb(255, 252, 225); font-family: &amp;quot;Courier New&amp;quot;, Tahoma; font-size: 9pt;"&gt;protected void WebGrid1_Export(object sender, ISNet.WebUI.WebGrid.ExportEventArgs e)&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;        {
            e.Table.Rows.Clear();

            DataRowCollection rows = (&lt;span style="text-decoration: underline;"&gt;WebGrid1.DataSourceManager.CurrentDataSource&lt;/span&gt; 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);
            }
        }&lt;/pre&gt;</description></item></channel></rss>