erotik film
bodyheat full moves www xxx kajal video la figa che sborra ver video de sexo porno
Luxury replica watches
escort antalya

** THIS SITE IS AN ARCHIVE ** - New Content is at:

May 8

Written by: Michael Washington
5/8/2011 7:01 AM  RssIcon

The LightSwitch filter extension is really cool. It is one of the LightSwitch features that has no comparison. It is a feature that, if you decide not to use LightSwitch for a project, you lose that feature completely.


First, we download and install the extension at this link:


Next, we grab the Call Log LightSwitch application at this link, and we go into the Properties of the project and select Extensions, then check the box next to LightSwitch Filer Control.


In the Solution Explorer, we right-click on the PhoneCalls table and select Add Query.


We select Add Query Element, then Add Parameter.


We add a parameter called FilterTerm (type of String).


We select Write Code, and then select PreProcessQuery.

We enter the code in the following method:


    partial void FilterCalls_PreprocessQuery(string FilterTerm, ref IQueryable query)
        query = LightSwitchFilter.Server.FilterExtensions.Filter(query, FilterTerm, this.Application);



Next, we right-click on Screens and select Add Screen.


We select Search Data Screen, FilterCalls, and then click OK.


We change the control type for Phone Call Filter Term to Advanced Filter Builder.


We hit F5 to run the project…


We can now create and save search queries.


You can download the code at this link.

31 comment(s) so far...

Thanks Michael. I didn't know that the control code was released already. This should help us a lot since our DB contains close to million records.

Does it work with foreign keys and all datatypes?

By PowerBala on   5/8/2011 6:42 PM

@PowerBala - It should but I haven't tried it.

By Michael Washington on   5/8/2011 7:56 PM

This is an awesome control. It definitely saved me a lot of development time.
One thing to be aware of is that it currently doesn't handle the >,>=, < and <= comparisons on string columns.
Hopefully this will be fixed in the near future.

By Tom on   5/10/2011 5:20 AM

@Tom - Microsoft is giving us the source code for this one, so we can enhance it ourselves... wow! :)

However, I am unsure exactly how >,>=, < and <= comparisons on string columns should be handled?

=, !=, and 'contains' are the only comparisons that I understand for string columns.

By Michael Washington on   5/10/2011 5:26 AM

I just came across this extension, and it looks great, but the Save button seems to be a waste of time as it only saves the filter for that run of the application. Surely it would be better to save the filter so it can be run again next time you open the application?

By Yossu on   8/3/2011 4:08 AM

just what i needed, really thought through (seems like google:).

By jan van gorp on   8/11/2011 10:35 AM

I have a need to have two tables (side by side) in one screen, both tables need the Filter Extension.

If I initiate building the table by selecting one the filter query for Table1, I can establish the Filter Extension as identified above. But when I add another query (the other query for Table2), I cannot seem to get the parameters to bind. I get the error "Cannot assign type 'CollectionView$Table2' to 'String?'.

Is there a way to use the filter extension in two different tables on the same screen?

If not, how can I open two different screens simultaneously?

Thanks for advice.

Kenneth James

By Kenneth James on   8/26/2011 3:27 PM

@Kenneth James - I did not create the control so I don't know it very deeply (actually the totality of my knowledge is in the article). The fastest way to get in contact with the original developer, Sheel, is to post to the forums at:

By Michael Washington on   8/26/2011 3:30 PM

When I save the query I have the following error

I found a solution on the forum (making the _clauseType public), but when I rebuild the filtercontrol solution, and install it again with the vsix file (after uninstalling it before), nothing changes, still I get the same error.

I have the feeling that the "rebuilded extension" is not changed, but I
- uninstalled filter control extention,
- rebuild the filter control solution
- reinstalled the filter control extention,
- made a new project and made everything from scratch

it seems to have no effect.
any suggestions?

By jan van gorp on   9/14/2011 4:20 AM

in the search field list,how to show field's DisplayName??

By greystar on   11/17/2011 11:14 PM

I downloaded the filter control today and I ran into 2 problems.

1. This version does not show the save options by default. You need the select the filter control in the designer. In the Properties window under the group Appearance there is a checkbox "Display Report Save Options". If checked the save options are showed.

2. When i want to save the report I get a serialization error on the member _clauseType. To solve this error I have opened the filter control solution. This solution came with the download of the filter control. Open the following file: LightSwitchFilter.Client=>LightSwitchFilterControls=>Clause.vb. Search for the member _clauseType (line 47 in my case). The problem is the line above where the datamember attribute is declared. This attribute needs to be declared before the public property ClauseType and is not needed for the private member _clauseType. So cut the line 46 and paste it before the public property. Build the solution (release configuration in my case) and grab the .vsix from the output directory of the LightSwitchFilter.Vsix project. Now uninstall the filter control and restart visual studio. Run the new .vsix file and everything is working fine again.

By Dytiscus on   11/23/2011 4:49 AM


I had the same issue and followed your instructions, which resolved the _clauseType error. My question to you is that it seems to only save the query during the current execution of the screen. If I save the filter criteria, and close the screen (not even exiting the application), the Existing Report dropdown is empty. This was eluded to by Yossu's comment above. Is this what you are experiencing as well?

Anyone else getting this behavior, or has anyone been able to use it to retrieve previously saved filters?

By LThibx on   12/5/2011 1:34 PM

how to show DisplayName ,when filter controls run time.

My Table

Emps table's name is Employee
ColName DisplayNmae
ID EmpCode
EName EmpName

how to do it ?

By greystar on   3/4/2012 8:37 PM

partial void FilterCalls_PreprocessQuery(string FilterTerm, ref IQueryable query)


query = LightSwitchFilter.Server.FilterExtensions.Filter(query, FilterTerm, this.Application);


WHEN I TYPE: query = ALL I GET IS LightSwitchApplication i do not get LightSwitchFilter.. what am i doing wrong please tell :@

By oli on   5/18/2012 7:33 AM

Also, When i download your Example code.. it says i do not have the correct extension. Showing that i need LightswitchFilter... instead of Lightswitch Filter Control.

Please can you post the correct link to where i can find this specific controll?

many thanks

By olisherr424 on   5/21/2012 1:55 AM

Got it to work now, had to use this code though instead of the code above.

query = FilterControl.FilterExtensions.Filter(query, FilterTerm, this.Application);

By olisherr424 on   5/21/2012 4:27 AM

Michael - is there a way to load a saved query by default when the screen loads?

Thanks, James

By James Black on   6/14/2012 5:21 PM

@James Black - No

By Michael Washington on   6/14/2012 5:21 PM

Hi Michael,

Have you got this working in the RTM version of VS2012? When I try to load the Filter Control to change the DataMember line so it can be serialised, then VS2012 does not load the project, so I can't recompile the VSIX file! Why would the Microsoft team not just fix it in 2 minutes and save everyone a lot of time?!

FilterControl\FilterControl.Lspkg\FilterControl.Lspkg.vbproj: The application which this project type is based on was not found. Please try this link for further information:

By Rodney Joyce on   9/10/2012 5:43 AM

@Rodney Joyce - I have not had a chance to use it in VS2012

By Michael Washington on   9/10/2012 5:49 AM

I managed to get this working - you need to install VS2012 SDK and the ightswitch extensions.

However, the control is useless because:

1) The saved reports are not persisted on reload
2) The checkbox to hide the "Save Reports" control does not work

By Rodney Joyce on   9/10/2012 5:48 PM

A fix for '2) The checkbox to hide the "Save Reports" control does not work' item is posted here:

I applied the fixes outlined in the thread to the downloaded extension source code (VS 2012 RTM), rebuilt the vsix file, and installed. The "Save Options" checkbox now works as expected.

WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("dnn$ctr382$MainView$ViewEntry$cmdAddComment", "", true, "", "", false, true))

By Patrick Sturmer on   9/29/2012 2:46 PM

could you share how you fixed the save report control? I have downloaded the solution, and installed the VS 2012 SDK, and the Extensibility ToolKit. But when I open the solution, I am getting the following error:

C:\Users\jason\Downloads\Filter Control\VB\FilterControl\FilterControl.Lspkg\FilterControl.Lspkg.vbproj : error : The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v2.0\Microsoft.LightSwitch.Toolkit.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. C:\Users\jason\Downloads\Filter Control\VB\FilterControl\FilterControl.Lspkg\FilterControl.Lspkg.vbproj

By Jason White on   10/6/2012 8:29 AM

@Jason White - When you download the SDK there is a readme file that instructs you to copy the Microsoft.LightSwitch.Toolkit.targets file into a directory (this is in addition to installing it).

By Michael Washington on   10/6/2012 8:31 AM

that fixed the problem, thanks for the tip


By Jason White on   10/8/2012 6:17 PM

I just upgraded a project from VS2010 to VS2012 and had to deal with issues in the FilterControl same as I did in VS2010. Ironically the same bug exist in the VS2012 version. Seems like they could have fixed that. I want to share part of my experience with you, as I ran into a peculiar issue.

Having both the _clauseType not public serialization error outlined here and in other messages, and the one here where the save options checkbox was not on the Properties panel for the Advanced Filter Term control (, I updated the code as suggested, recreated the FilterControl.vsix, and reinstalled package as instructed. But then using it in my target project would result in the same issues, as if I had not updated the extension at all.

Reviewing the references in my target project for the Client and Server projects, I noticed that the references for the FilterControl dlls were being referenced to a subfolder of my target project named: ..\Visual Studio 2012\Projects\_Pvt_Extensions\FilterControl\Client\Reference for the Client project references, and ..\Visual Studio 2012\Projects\\_Pvt_Extensions\FilterControl_sav\Server\Reference for the Server project references.

The updated dlls for the FilterControl are in my Filter Control project folder: ..\Visual Studio 2012\Projects\Filter Control\VB\FilterControl\FilterControl.Client\Bin\Release for the Client project

\Visual Studio 2012\Projects\Filter Control\VB\FilterControl\FilterControl.Common\Bin\Release for the Common Project

\Visual Studio 2012\Projects\Filter Control\VB\FilterControl\FilterControl.Server\bin\Release

I have noticed that every time I redeploy the FilterControl.vsix extension, the references in my target project get changed back to the \_PVT_Extensions subfolder structure which are not getting updated with deployment, so every time I have to change the references to the FilterControl project where the updated dlls are. I don't know why this is happening. Would be good if someone could shed some light, but at least I know how to deal with it.

So if you are making changes as described on this page and others to resolve the issues with the FilterControl and you are not seeing your changes, the above may be your issue.

One last thing. The Save button on the control does save the criteria to an xml file in IsolatedStorage. This is found under (Win7): C:\Users\\AppData\LocalLow\Microsoft\Silverlight\is... Just navigate here and search for .reports. The criteria is stored in a file named as: ...reports You can even view it and see the criteria you had specified. Problem is that for some reason the extension will not retrieve this info after the screen is closed and reopened, nor does the drop down selection work correctly when you have saved different sets of criteria and try to switch your selection. When I get a chance I will attempt to review the code and see if I can fix that. For now I just disable the display of the Save options.

It would be REALLY NICE if the author would address these issues. The control is almost a necessity in many projects, fixing these deficiencies would escalate it from great to AWESOME.


By Lonnie Thibodeaux on   12/29/2012 8:40 AM

I haven't seen this posted anywhere, but if finally found the solution to the control not bringing up existing reports after the screen is reopened can be solved by fixing a bug in the Clause.vb code, in the FieldDefinition property code, it didn't check for a null object:
Public Property Field As FieldDefinition
Return _field
End Get
Set(value As FieldDefinition)
_field = value
If Field IsNot Nothing Then 'add this check
If Field.TypeName = "Entity" Then
Me.Value = "Nothing"
End If
End If
End Set
End Property

By Bill Schleich on   9/3/2013 4:10 AM

Is there a way to use the LightSwitch Filter extension to work with lookup fields? For example, one table/entity has many foreign keys (integers) to look up things like countries, status descriptions, clients, etc. (everything is in an external database), but when one of these fields is used in the filter extension, the comparison box on the right changes to a combobox with only 2 options: 'Nothing' and 'Not Nothing'.

Any ideas anyone?

By Richard on   9/25/2013 4:47 AM

Does anyone encountered an issue in this control in which you can not filter a related entity from different data source?

Let's say I have an Address Table from Data Source A, and it has a related table City from Data Source B.

When using the filter control from the Address screen, and I selected the City.Name (table and column), then input anything from the text box, it will throw "Not Implemented" exception.

By Cody on   11/7/2013 4:37 AM

Hi Michael,

Can I have two parameters:
string and Integer?
I have a string: query = FilterControl.Filter(query, FilterTerm, Me.Application)

Thanks, Elena

By Elena on   11/7/2013 3:21 AM

@Elena - I do not know. You can as on the official LightSwitch forums at:

By Michael Washington on   11/7/2013 4:38 AM
Microsoft Visual Studio is a registered trademark of Microsoft Corporation / LightSwitch is a registered trademark of Microsoft Corporation