0

I have created the application of Linq to Sql dynamic data site. I have many tables with the relational structure. For example: tblSite, tblSiteImage, tblSiteAdvertisement, tblGenericCategory, tblEntityType etc. tblSite is my parent table for all the other tables. I would like to apply the filter for all these tables i.e. the filter of tblSite.

That means, there should be the Drop down list(DDL) of tblSite data. After changing selection of the data from the DDL, it should filter the data from these tables.

Please note that the SiteId column exists in some of the tables like tblGenericCategory but not present in the table tblEntityType. But these 2 tables are connected using EntityTypeId column from tblEntityType.

So the relation shows something like below:

tblSite ------> tblGenericCategory ------> tblEntityType

I want to apply filter of SiteId to table tblEntityType.

So, my question is this:

How can I apply filter to the child of child table in Dynamic Data Site application?

Thanks in advance.

Vijay Pawar
  • 13
  • 1
  • 3

1 Answers1

0

You need query parent entity that has SiteId property along with children entity and put filter you need. It's possible inf L2S and EF, not sure about DataAdapters. If not then you need to build queries manually.

LINQ2Vodka
  • 2,996
  • 2
  • 27
  • 47
  • I am using the L2S in Dynamic Data Site. I am able to apply filter for tblGenericCategory but don't know about applying the filter to its child table. That means, I need to apply filter on child of child table i.e. tblEntityType is child of tblGenericCategory and tblGenericCategory is child of tblSite table. – Vijay Pawar Nov 10 '13 at 12:26
  • @VijayPawar please take a look here: http://msdn.microsoft.com/en-us/library/system.data.linq.dataloadoptions(v=vs.110).aspx . By using this you are able to attach depended entities to the main one and put any filter you want (like select only rows from my table that have parent's name="Foo". Im not sure if it can be applied for deeper relations (see the link). If it doesnt help then i am sorry. got nothing more to advice. – LINQ2Vodka Nov 10 '13 at 12:39