tag:blogger.com,1999:blog-7429901495286230670.post2270418678939070198..comments2022-03-01T09:46:35.079+13:00Comments on Lachlan's Blogzone: LINQDataSource Many-to-many filtering Hell!!Lachlan Keownhttp://www.blogger.com/profile/14681765389224928298noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-7429901495286230670.post-27502507606447481362008-06-26T11:58:00.000+12:002008-06-26T11:58:00.000+12:00instead of handling the Selected event, handle the...instead of handling the Selected event, handle the Selecting event and write a little LINQ code.<BR/><BR/>You also won't have to enable updates/deletes this way.<BR/><BR/>Try this:<BR/><BR/> Protected Sub LinqDataSource1_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LinqDataSourceSelectEventArgs) Handles LinqDataSource1.Selecting<BR/> Dim orderId As Integer = 10248<BR/><BR/> If Request("orderid") IsNot Nothing Then<BR/> orderId = CInt(Request("orderid"))<BR/> End If<BR/><BR/> Dim nl As New NorthwindLinqDataContext()<BR/> Dim products = From p In nl.Products _<BR/> Join od In nl.Order_Details _<BR/> On p.ProductID Equals od.ProductID _<BR/> Where od.OrderID = orderId _<BR/> Select p<BR/><BR/><BR/> e.Result = products<BR/><BR/><BR/> End SubUnknownhttps://www.blogger.com/profile/07518114873717506252noreply@blogger.com