How to use WHERE clause on related table in LinqDataSource

I've used the LinqDataSource successfully with a WHERE clause that applies to the table being selected.

What I need to do now, is select data from the table after using a WHERE clause on a related table instead of the "current" table.

Can this be done with LinqDataSource (I'm using LinqDataSource both for fast prototyping, plus built-in paging capabilities w/ GridView)?

MORE INFO:
I have 2 table objects in my User.dbml:
Provider: List of course providers)
ProviderXUser: Cross-reference table listing which of my website's users (UserDetails table) are also members of a Provider

I tried the following, but it throws the error (I've double-checked that FkUserDetailsId does exist in ProviderXUsers):
"No property or field 'FkUserDetailsId' exists in type 'EntitySet`1'"

        <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="UserDataContext"
        TableName="Providers" Where="ProviderXUsers.FkUserDetailsId == 1 " >
        <WhereParameters>
          <asp:Parameter DefaultValue="1" Name="Type" Type="Int32" />
        </WhereParameters>
      </asp:LinqDataSource>
cdakzAsked:
Who is Participating?
 
cdakzAuthor Commented:
I looked over http://www.experts-exchange.com/Programming/Languages/.NET/LINQ/Q_24444368.html but it wasn't clear what the solution was to me.

What I was after was a way to use the datasource "wizard" so that I could, through its UI, generate the correct code.

From what I've gathered since posting this question, the way to accomplish this is programmatically, in the _Selecting event, as explained at: http://weblogs.asp.net/scottgu/archive/2007/09/07/linq-to-sql-part-9-using-a-custom-linq-expression-with-the-lt-asp-linqdatasource-gt-control.aspx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.