﻿<?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 - Client Binding Virtual Group Paging - Handle Join Tables</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Client-Binding-Virtual-Group-Paging---Handle-Join-Tables/</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>Client Binding Virtual Group Paging - Handle Join Tables</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Client-Binding-Virtual-Group-Paging---Handle-Join-Tables/</link><pubDate>Tue, 12 Oct 2010 02:38:54 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;The only way I could make it work is by using this query&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;var datasource = from b in context.Bugs&lt;br /&gt;				 join o in context.Owners on b.BugId equals o.BugId into tl_j&lt;br /&gt;&lt;br /&gt;				 from j in tl_j.DefaultIfEmpty()&lt;br /&gt;				 select new BugWithOwner&lt;br /&gt;				 {&lt;br /&gt;					  BugId = b.BugId,&lt;br /&gt;					  ChangeInLast = b.ChangeInLast,&lt;br /&gt;					  Component = b.Component,&lt;br /&gt;					  Dupe = b.Dupe,&lt;br /&gt;					  OpSys = b.OpSys,&lt;br /&gt;					  Severity = b.Severity,&lt;br /&gt;					  Summary = b.Summary,&lt;br /&gt;					  Target = b.Target,&lt;br /&gt;					  OwnerId = j == null ? -1 : j.OwnerId,&lt;br /&gt;					  OwnerName = j == null ? "--" : j.OwnerName&lt;br /&gt;				  };&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Client Binding Virtual Group Paging - Handle Join Tables</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Client-Binding-Virtual-Group-Paging---Handle-Join-Tables/</link><pubDate>Mon, 11 Oct 2010 22:14:41 GMT</pubDate><dc:creator>dmcgoff</dc:creator><description>&lt;p&gt;Hi Glenn,&lt;/p&gt;
&lt;p&gt;That solved my issue with the join - thanks!  I now have a follow up issue.  I am using a left join, so some of the columns contain "Null" values.  I attempted to use a default values class to replace the Nulls.  Unfortunately, I am getting an error.&lt;/p&gt;
&lt;p&gt;The attached sample shows the error.&lt;/p&gt;
&lt;p&gt;Can you take a look?&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;&lt;br /&gt;Dave&lt;/p&gt;</description></item><item><title>Client Binding Virtual Group Paging - Handle Join Tables</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Client-Binding-Virtual-Group-Paging---Handle-Join-Tables/</link><pubDate>Sun, 10 Oct 2010 22:52:59 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;Under such scenario, you will be required to create a new class to hold the new object. In my sample, I create a BugCustom class that will allow me to hold the new property. Here is the snippet:&lt;/p&gt;&lt;p&gt;Class definition&lt;/p&gt;&lt;pre&gt;public class BugCustom&lt;br /&gt;{&lt;br /&gt;    public int BugId { get; set; }&lt;br /&gt;    public string Summary { get; set; }&lt;br /&gt;    public string OwnerName { get; set; }&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;Select function (I do not have the Owners table, the select is simulated to return row with 3 column)&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;[WebMethod]&lt;br /&gt;public object GetPagedBugsCustom(DataSourceSelectArguments selectArguments)&lt;br /&gt;{&lt;br /&gt;    BugTrackerModelDataContext context = new BugTrackerModelDataContext();&lt;br /&gt;    context.DeferredLoadingEnabled = false;&lt;br /&gt;&lt;br /&gt;    var datasource2 = &lt;br /&gt;        from b in context.Bugs&lt;br /&gt;        select new BugCustom { BugId = b.BugId, Summary = b.Summary, OwnerName = "TestOwner" };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    WebGridDataProvider&amp;lt;BugCustom&amp;gt; provider = new WebGridDataProvider&amp;lt;BugCustom&amp;gt;(datasource2.AsQueryable());&lt;br /&gt;    object data = provider.Select(selectArguments);&lt;br /&gt;&lt;br /&gt;    if (data != null)&lt;br /&gt;        return data;&lt;br /&gt;&lt;br /&gt;    throw new InvalidOperationException("Unsupported operation type!");&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;The WebGrid client binding setting property&lt;/p&gt;&lt;pre&gt;&amp;lt;ClientBindingSettings DataLoadMode="PagedData" DataSourceType="WebService" PreloadGroupTotals="true"&lt;br /&gt;    ItemTypeName=&lt;span style="color: rgb(255, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;BugCustom&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;"&lt;/span&gt; ServiceUrl="WebService.asmx" EnableGroupRowPaging="true" GroupRowPageSize="20"&amp;gt;&lt;br /&gt;    &amp;lt;ServiceMethods SelectMethod=&lt;span style="color: rgb(255, 0, 0);"&gt;"GetPagedBugsCustom"&lt;/span&gt; /&amp;gt;&lt;br /&gt;&amp;lt;/ClientBindingSettings&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;</description></item><item><title>Client Binding Virtual Group Paging - Handle Join Tables</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Client-Binding-Virtual-Group-Paging---Handle-Join-Tables/</link><pubDate>Fri, 08 Oct 2010 12:42:42 GMT</pubDate><dc:creator>dmcgoff</dc:creator><description>&lt;p&gt;I am using the &lt;span style="font-family: consolas; color: #0000ff; font-size: 13px"&gt;&lt;span style="font-family: consolas; color: #0000ff; font-size: 13px"&gt;&lt;span style="font-family: consolas; color: #0000ff; font-size: 13px"&gt;ClientBinding_VirtualGroupPaging_WebService &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Example.  My scenario requires that I join 2 tables in order to get the necessary data for my grid.  &lt;/p&gt;
&lt;p&gt;With a single table I have no issues.  When joining tables I am not sure of what object to use in the Provider declaration (basically how should I fill the "???" in: WebGridDataProvider&amp;lt;???&amp;gt;).&lt;/p&gt;
&lt;p&gt;Below is my code for 1) Single table and 2) join.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;pre&gt;[WebMethod]

public object GetPagedBugs(DataSourceSelectArguments selectArguments)

{

BugTrackerModelDataContext context = new BugTrackerModelDataContext();

context.DeferredLoadingEnabled = false;

// 1) Single table works great

var datasource = from b in context.Bugs

select b;

WebGridDataProvider&amp;lt;Bug&amp;gt; provider =

new WebGridDataProvider&amp;lt;Bug&amp;gt;(datasource);

// -----------------------------------------

// 2) How to join?

var datasource2 = from b in context.Bugs

join o in context.Owners on b.BugId = o.BugId

select new { b.BugId, b.Summary, o.OwnerName };

WebGridDataProvider&amp;lt;???&amp;gt; provider =

new WebGridDataProvider&amp;lt;???&amp;gt;(datasource);

// -----------------------------------------

object data = provider.Select(selectArguments);

if (data != null)

return data;

throw new InvalidOperationException("Unsupported operation type!");

}
&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description></item></channel></rss>