.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Add a filter to an association

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :ASP.Net
I have a 1:M relationship between Contact and EmploymentHistory. I want to create a new association that is the current employment, which would be 1:1 so I can do Contact.CurrentEmployment. The EmploymentHistory table has a CurrentEmployment flag. Is there a way to do this in Entity Framework?    

View Complete Post

More Related Resource Links

Using jQuery to Filter Table Rows

The project is using the .net GridView control, so I had limited control over the output HTML code. Still, I think this code can work for most tables. One thing to notice: you should use the class "filterable" on your table or on one of its parents for the code to work.
First, we need a text box:

GridView Multiple Filter AJAX Control

This AJAX control enables the user to filter data within any column inside a GridView. The user can add multiple filters and can delete existing ones too.

Where to Filter the companies returned by the EF?



I am just starting with dynamic data. I have an enttity framework called UsersModel.edmx.

It returns a list of all companies in the tblCompany table. This list is really big.

I need to filter the list returned to all user controls on the client so that it only returns the company that have a CompanyTypeId= 2 or CompanyTypeId= 3 and company name != "".

1 - Is it possible to filter the company list returned on the server so that I can filter only once for all the controls that use that on the client?

My ideas was to do something like this using linq and lambda but I am not sure how:

return tblCompanys.Where(c => c.CompanyTypeId == 2 || c.CompanyTypeId == 3 && ).Where(c=>c.CompanyName != "").OrderBy(c => c.CompanyName).Distinct().OrderBy(c=>c.CompanyName);

2 - I have created a partial class and a metadata class and added the DisplayColumn attribute to use the company name and sort by company name ascending.

Could I use the code to filter the returned companies in this? where?

namespace MarsMedicalModel
    [DisplayColumn("CompanyName", "CompanyName")]
    public partial class t

Filter by Computed Column



After looking for a driver to open legacy dbf drivers to connect, the next level trouble a have is this one:

first, i can retrieve the data but when trying to filter by a parameter (somesc columns) i get an error.

The error says about the database can't determine some blah blah!

The error is a columm tha is formated (  1234  ) about  8 space, fixed. The values in the query appears like that. I resolve this by Trimming Ltrim(ColumnName) and i get this (1234).

Now in SqlExpress, how can i filter by the new Trimmed Expression? (This is a primary key that the DBF use)


SELECT column1, column2, column3


SELECT Ltrim(column1) as NewExp, column2, column3
Where NewExpre = @NewExpres                  -Error-


LDAP nested groups filter


Hi all,

In my organization we use nested groups.

For a particular usage, we have a group (let's assume that the group name "kuku"), and the names of all the nested groups under it contains "kuku" as well.

We may assume that no other group in the LDAP has "kuku" in the name.

I need to create a filter which will return all the users which belong to one of the "kuku"s group.

Obviously, using this filter will bring only the head kukus

(&(&(objectclass=user)(objectclass=person))(memberOf=CN=kuku,cn=.rest of the group DN.))

How can I use wild card to fetch all users which belong to any kuku?

For example: (&(&(objectclass=user)(objectclass=person))(memberOf=CN=.*kuku.*))



Urgently Need Help : Unrecognized Tag Prefix or device filter 'CR'


I have download and installed the Crystal Report for 2010 from my Visual Studio 2010. 


Problem 1 :

When I create a new crystal report in the Project, the aspx created code below :

<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"
            AutoDataBind="True" GroupTreeImagesFolderUrl="" Height="1202px"
            ReportSourceID="MemberList" ToolbarImagesFolderUrl="" ToolPanelWidth="200px"
            Width="1104px" />
        <CR:CrystalReportSource ID="MemberList" runat="server">
            <report filename="MemberList.rpt">

 but there is error : unrecognized tag prefix or device filter 'CR'


Problem 2 :

The vb code of the crystal report that I had created has 'ComponentModel is not a member of 'MYPROJECT.system'



ISA Server 2004: Developing an Application Filter for Microsoft Internet Security and Acceleration S


The beta version of Internet Security and Acceleration (ISA) Server 2004 is now publicly available. It includes a rich SDK with several extensibility mechanisms that allow third parties to integrate their specialized solutions on top of the ISA platform. In this article, the author explores the application filter extensibility mechanism, which enables you to add high-level application layer filtering capabilities to ISA Server and to provide rich content filtering solutions. He also highlights the new features of the ISA Server 2004 SDK, then moves on to describe how to develop a basic application filter that monitors all data going through the ISA Server, and how to integrate a filter into the ISA Server management console to create a seamless interface experience for your users.

Yigal Edery

MSDN Magazine March 2004

ISAPI Filters: Designing SiteSentry, an Anti-Scraping Filter for IIS


The Microsoft Internet API for IIS, ISAPI, sits between the client and the Web server. Therefore, you can access the HTTP data stream before IIS gets to see it. The project in this article takes advantage of the ISAPI architecture to create a filter that monitors access to a Web site to determine if visits are from typical users or from automated processes designed to pilfer information from your site. The author tracks the regularity of visits to the site to determine the likely source. Once the determination is made, the app either redirects the user or continues to track information about those hits.

Rodney Bennett

MSDN Magazine October 2001

MVC 3 Preview 1. Inject value in Action Filter



I was reading MVC3 Preview 1 release and I found this:

Dependency Injection at all levels - We opened up seams for applying the dependency injection when instantiating components of the framework. This allows developers to hook into the creation of models during model binding, action filters, etc.

Does that mean I can inject a value into an Action Filter?

This is a problem I have for a long time and it would be really useful.

How can I do this?



MVC3: Define Dynamic ViewModel property inside Action Filter



How can I define a Dynamic ViewModel property in MVC 3 inside an action filter?

I am looking to have something like but inside the ActionFilter and not in the controller:

ViewModel.Title = "Home";

Thank You,


filter n compare between two table in resultset


Hi .. I have two table 

Say Table1 n Table2


Item              ItemName

001                 Laptop

001                  PC

002                  PC

002                  Printer

003                  Pendrive

004                  Keyboard

004                  CPU


Item                  ItemName

001                   laptop

001                   PC

002                   Printer

004                   CPU

Here am comparing table1 with table2

The Itemname which is available in both table1 n table2 should be dropout ... Other Item should be displayed ...

I need the sql result set like this :

Item                 &n

sqldatasource's filter returns too few records


I have a puzzling issue.  This is in asp.net 2.0, using vb.  I have a gridview that is bound to a sqldatasource.  Here is the datasource code:

<asp:SqlDataSource ID="fellowsSqlDataSource" runat="server"
        ConnectionString="<%$ ConnectionStrings:PFPFellowsConnectionString %>"
        ProviderName="<%$ ConnectionStrings:PFPFellowsConnectionString.ProviderName %>"
        FilterExpression="{0}"  >
            <asp:SessionParameter Name="psuaccessid" SessionField="username" />         

'asp' is an unrecognized tag prefix or device filter


Hi There,

I have been using Visual Web Developer Express Edition Beta 1 Refresh and Visual Studio 2005 Beta 1 for the past few weeks. For some unforeseen reason VS now reports the error -'asp' is an unrecognized tag prefix or device filter on all my .aspx pages.

The solution compiles and launches without any mishap and the only way to alter page control properties is in design view, as intellisense does not function due to the errors.

I've search the web and found a resolution which was to remove all files in the folder:

C:\Documents and Settings\[Username]\Application

But the issue still exists.

Any assistance would be greatly appreciated.



Filter search over multiple text columns


Hi everyone,

I'm working on a library that stores information on various cases. The case table has several columns that contain descriptive strings on what happened in the case. I would like to create a single filter that returns all cases where the search string is found in any of the columns. I've looked at Dynamic Data Filtering, but as far as I can tell, the "Contains" filter only allows you to connect to each column individually. Has anyone tried this?



Association creation error


In the dbml Designer surface in VS2010, I am associating two views from a database which I am only granted for View access. 

The View1 has 
  Site (smallint, not null)
  LocationID (int, not null)

The View2 has
  Site (int, not null)
  LocationID (int, not null)

Due to the incompatible types between this two, the association can not be created.  Is there other way to create the association, such as cast(View1.Site as int) in the assocation?

How to filter the search result based on a column value?

I do have search scope scoped at a list which contains attachment. I will use this scope to search (full text search) on this list then I need to filter the result based on a column which is in the same list. How do I do that? Thank you.

Issue in Infopath 2007 browser form - cascading dropdown using owssvr.dll filter view


Referring the below link, I created a cascading dropdown. The parent dropdown has sharepoint list as datasource and the child dropdown has xml datasource that points to owssvr.dll filter view. The cascading drop down works fine in preview but throws error after publishing as admin approved form - "form cannot run the specified query" exception when trying to execute xml datasource i.e., when a value is selected in parent dropdown. The security is 'Full Trust". In the event viewer the error message states "401 unauthorised" for the user a/c. the xml data source is an approved udcx file and in central admin, have enabled cross domain for infopath service. I have tried different solution provided in tech forums but issue still exists. Not sure whether Im missing something. Can someone guide me in fixing this issue?

Link Reffered:



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend