Search code examples
c#visual-studio-2013visual-studio-lightswitchlightswitch-2013

Return data in lightswitch only after search


I'm dipping my toes into the lightswitch arena and am trying to rewrite an application that they want to keep similar to its roots, to prevent too much user headaches, and the first screen is a simple database search. You have several fields you can search on and then you click search.

In lightswitch, it seems you have to return a data list/grid/table first and then do the search. Is there anyway to prevent the data from coming in until after you do the search on the criteria? Thanks!


Solution

  • If you are intending to do this for a Silverlight client, you could turn off the "Auto Execute Query" setting for the collection. This basically prevents the runtime from automatically executing the query in which case you are responsible for writing the code necessary to execute the query at the appropriate time(s). See this page for more info (search for "Auto Executing Queries"): http://blogs.msdn.com/b/bethmassi/archive/2012/05/29/lightswitch-tips-amp-tricks-on-query-performance.aspx.

    If this is for an HTML client, it doesn't look like there's support for turning off the Auto Execute Query functionality. See http://social.msdn.microsoft.com/Forums/en-US/8ba5bc5f-b3fe-44d3-a7e8-67d924b7772d/html-client-autoexecute-query.