locked
custom filter search section RRS feed

  • Question

  • Hello, I'm trying to figure out how to create a filter control for my datagrid:

    User selects Month from a drop down control, then Year from drop down control, then presses a search button.  The grid table below refreshes and returns rows where the month and field columns match the filter search.

    Any help on this, if its possible?  thanks

    Saturday, March 26, 2011 12:26 AM

Answers

  • It is very possible to do this. This would involve adding two local properties to your screen (one for Month and the other for Year, both probably should be Integer properties) and creating a parameterized query that has two parameters (one for Month and the other for Year) that returns a result set limited by the parameters. Please take a look at Beth Massi's blog post Creating a Custom Search Screen in Visual Studio LightSwitch, which will show you how to create a search screen, but is very close to what you want to do.

    When you do create the local properties and drag them out to the content tree, you can change the control type to Auto Complete Box. At this point, you can either populate the choice list property in the property sheet for the local properties so that they have static lists OR you can select the Auto Complete Box and specify a query for the Choices property. To do the latter, the data types of the local properties have to be entities.

    Saturday, March 26, 2011 1:05 AM

All replies

  • It is very possible to do this. This would involve adding two local properties to your screen (one for Month and the other for Year, both probably should be Integer properties) and creating a parameterized query that has two parameters (one for Month and the other for Year) that returns a result set limited by the parameters. Please take a look at Beth Massi's blog post Creating a Custom Search Screen in Visual Studio LightSwitch, which will show you how to create a search screen, but is very close to what you want to do.

    When you do create the local properties and drag them out to the content tree, you can change the control type to Auto Complete Box. At this point, you can either populate the choice list property in the property sheet for the local properties so that they have static lists OR you can select the Auto Complete Box and specify a query for the Choices property. To do the latter, the data types of the local properties have to be entities.

    Saturday, March 26, 2011 1:05 AM
  • thanks, ill post back on my results.
    Monday, March 28, 2011 3:24 PM
  • it worked, thanks
    Monday, March 28, 2011 8:28 PM