That is what I do I usually add the AdvancedFilterRepeater from the DDFutures project on Codeplex and then write custom filters that hide them selves but still filter [:)]
Dynamic Data
See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
MH0
Member
75 Points
29 Posts
Master/Detail Filtering
Nov 24, 2009 10:07 AM|LINK
Hi,
I'm new to Dynamic Data and L2S. I hope I can find some help here.
My first question is about data filtering. How do I implement filtering at the data model level for a scenario like this.
Users
- UserId
- Data
Reports
- ReportId
- UserId
- Data
Measurements
- MeasurementId
- ReportId
- Data
I'm using the Dynamic Data Linq to SQL WebApp in VS2010b2.
For the Reports table I know I can use code like this in the List template:
if (table.Name == "Reports") { var param = new SessionParameter(); param.Name = "UserId"; param.Type = TypeCode.Int32; param.SessionField = "UserId"; GridDataSource.WhereParameters.Add(param); }But how do I apply filtering to the Measurements table and shouldn't this be done at the data layer and not at the presentation layer?
Thanks in advance,
MH
sjnaughton
All-Star
27330 Points
5459 Posts
MVP
Re: Master/Detail Filtering
Nov 24, 2009 01:36 PM|LINK
Hi MH, your are correct te filtering would be best done at business layer unfortunaly nither Linq to SQL or Entity Framework allows that.
However using DomainService in the future will allow this sort of thing easily but it has only just gone into beta see: http://www.microsoft.com/downloads/details.aspx?FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce&displaylang=en and the ASP.Net bit's here: http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27026
And the VS2010 bits here: http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=35801 this is the DomainDataSource preview (alpha code) see the old Preview for the Domain Service ProjectTemplate.
This is a bit messy at the moment but if you have a look at the Preview 4 sample you will see a good model for adding a business layer to DD.
Dynamic Data
Always seeking an elegant solution.
MH0
Member
75 Points
29 Posts
Re: Master/Detail Filtering
Nov 24, 2009 08:13 PM|LINK
Hi Steve, thank you but I'll use filtering in the presentation layer for now.
if (table.Name == "Measurements") { var param = new SessionParameter(); param.Name = "Reports.UserId"; param.Type = TypeCode.Int32; param.SessionField = "UserId"; GridDataSource.WhereParameters.Add(param); }sjnaughton
All-Star
27330 Points
5459 Posts
MVP
Re: Master/Detail Filtering
Nov 24, 2009 09:24 PM|LINK
That is what I do I usually add the AdvancedFilterRepeater from the DDFutures project on Codeplex and then write custom filters that hide them selves but still filter [:)]
Dynamic Data
Always seeking an elegant solution.