﻿<?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 - Export partial data in based on which selected in rowchecker</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Export-partial-data-in-based-on-which-selected-in-rowchecker/</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>Export partial data in based on which selected in rowchecker</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Export-partial-data-in-based-on-which-selected-in-rowchecker/</link><pubDate>Tue, 21 Jun 2011 03:48:06 GMT</pubDate><dc:creator>yudi</dc:creator><category>WebGrid</category><category>RowChecker</category><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;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.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;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.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;The snippet code below shows how to implement such scenario on a simple single-level WebGrid.&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;protected void&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;WebGrid1_Export(&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;object&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;sender, ISNet.WebUI.WebGrid.&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; color: #2b91af; font-size: 9pt"&gt;ExportEventArgs&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;e)
{&lt;/span&gt;
    &lt;span style="font-family: 'consolas', 'courier new'; color: green; font-size: 9pt"&gt;// get the total rows in the root table of WebGrid&lt;/span&gt;
    &lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;int&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;totalRows = WebGrid1.RootTable.Rows.Count;&lt;/span&gt;        

    &lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;for&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;(&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;int&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;i = 0; i &amp;lt; totalRows; i&amp;#43;&amp;#43;)
    {&lt;/span&gt;
        &lt;span style="font-family: 'consolas', 'courier new'; color: green; font-size: 9pt"&gt;// get the number of checked rows&lt;/span&gt;
        &lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;int&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;checkedRowsCount = WebGrid1.RootTable.GetCheckedRows().Count;&lt;/span&gt;
            
        &lt;span style="font-family: 'consolas', 'courier new'; color: green; font-size: 9pt"&gt;// a flag that shows whether row is match to one of the rows in the checked rows&lt;/span&gt;
        &lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;bool&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;IsMatch =&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;false&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;;&lt;/span&gt;

        &lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;foreach&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;(&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;string&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;keyValue&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;in&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;WebGrid1.RootTable.GetCheckedRows())
        {&lt;/span&gt;
            &lt;span style="font-family: 'consolas', 'courier new'; color: green; font-size: 9pt"&gt;// if current row is equal to one of the rows in the checked rows
            // then break&lt;/span&gt;
            &lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;if&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;(e.Table.Rows[i].KeyValue.ToString() == keyValue)
            {
                IsMatch =&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;true&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;;&lt;/span&gt;
                &lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;break&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;;
            }
        }&lt;/span&gt;

        &lt;span style="font-family: 'consolas', 'courier new'; color: green; font-size: 9pt"&gt;// if current row is equal to one of the rows in the checked rows
        // then passes to the next iteration
        // else remove current row&lt;/span&gt;
        &lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;if&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;(IsMatch)&lt;/span&gt;
            &lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;continue&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;;&lt;/span&gt;            
        &lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;else&lt;/span&gt;
        &lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;{
            e.Table.Rows.RemoveAt(i);
            i--;
            totalRows--;
        }
    }&lt;/span&gt;

    &lt;span style="font-family: 'consolas', 'courier new'; color: green; font-size: 9pt"&gt;// set the "IsRowChecker" to be not visible during export&lt;/span&gt;
    &lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;e.Table.Columns.GetNamedItem(&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; color: #a31515; font-size: 9pt"&gt;"IsRowChecker"&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;).Visible =&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;false&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;;
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;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.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Export partial data in based on which selected in rowchecker</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Export-partial-data-in-based-on-which-selected-in-rowchecker/</link><pubDate>Mon, 20 Jun 2011 03:23:50 GMT</pubDate><dc:creator>indah.ai@gmail.com</dc:creator><category>WebGrid</category><category>RowChecker</category><description>&lt;p&gt;Hi Team,&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;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.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;- Indah -&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>