How can I enable my Lightswitch grids to allow Searching on the Foriegn Key Fields? RRS feed

  • Question

  • Is there a way to make the foreign key fields of a table Searchable like the rest of the fields on the table. I don't want to code up an initial sort like I have seen published here, although Thank you as it is great information. I want to actually enable the same form of Search / Filter behavior against the Foreign Key fields as exists by default against the other columns.

    Or is it possible to place filtering drop-downs pick boxes on the screen similar to what you might find in Excel filtering column headers?

    I just want to give the users the ability to filter the data as they see fit and not be limited by the limitations of the Out of the Box behavior.


       Stephen Donovan



    Tuesday, November 29, 2016 7:48 PM

All replies

  • One possible way to make those foreign key field tables searchable is to implement your own search:

    1. Create your own parameterized query that takes a string search parameter
    2. Implement the preprocessing query method (server side code in C#)
    3. Write appropriate LINQ statements inside the above method to filter on all fields across all relationships that you wish
    4. Add a textbox field above the grid (linked to the string search parameter) allowing the user to enter search text

    Regards, Xander. My Blog

    Wednesday, November 30, 2016 12:16 AM