Click here to Skip to main content
15,886,518 members
Articles / Web Development / ASP.NET

Filtering LINQ Queries Using Business Rules Engine

19 Nov 2012CPOL7 min read 35.4K   779   22  
This article discusses the use of one such new feature, namely, rule-based filtering of LINQ queries using Web Rule, the XML-based super-fast rules engine, implementable as an ASP.NET or MVC component.

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

<%@ Page Title="" Language="C#" MasterPageFile="~/Common/Controls/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CodeEffects.Rule.Demo.Filter.Asp.Default" %>

<%@ Register assembly="CodeEffects.Rule" namespace="CodeEffects.Rule.Asp" tagprefix="filter" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
	<div class="area">
		<h1 class="title">Postback Example</h1>
		<div class="settings">
			<div class="left">
				<span>Change the entity:</span>
				<asp:DropDownList ID="ddlEntity" runat="server" AutoPostBack="true">
					<asp:ListItem Value="customers">Customers</asp:ListItem>
					<asp:ListItem Value="products">Products</asp:ListItem>
					<asp:ListItem Value="orders">Orders</asp:ListItem>
				</asp:DropDownList>
			</div>
			<div class="left" style="margin-left:80px;">
				<span>Theme:</span>
				<asp:DropDownList ID="ddlTheme" runat="server" AutoPostBack="true">
					<asp:ListItem Value="White">White</asp:ListItem>
					<asp:ListItem Value="Blue">Blue</asp:ListItem>
					<asp:ListItem Value="Gray">Gray</asp:ListItem>
					<asp:ListItem Value="Green">Green</asp:ListItem>
					<asp:ListItem Value="Red">Red</asp:ListItem>
					<asp:ListItem Value="Black">Black</asp:ListItem>
					<asp:ListItem Value="Navy">Navy</asp:ListItem>
				</asp:DropDownList>
			</div>
			<div class="left" style="margin-left:30px;"><asp:CheckBox ID="chkHelp" runat="server" Text="Show help string" AutoPostBack="true" /></div>
			<div class="clear"></div>
		</div>
	</div>
	<div class="area">
		<h1 class="title">Filter Editor</h1>
		<div style="margin-top:10px;">
			<span>Info:</span>
			<asp:Label ID="lblInfo" runat="server" ForeColor="Red"></asp:Label>
		</div>
		<div style="margin-top:10px;">
			<filter:RuleEditor ID="filterControl" runat="server" Mode="Filter" />
		</div>
		<div style="margin-top:10px;text-align:right;">
			<asp:Button ID="btnSearch" runat="server" Text="Search" CssClass="button" />
			<asp:Button ID="btnClear" runat="server" Text="Clear" CssClass="button" />
		</div>
	</div>
	<div class="area">
		<h1 class="title">Search Results</h1>
		<div style="margin-top:10px;">
			<asp:GridView runat="server" ID="grdResults" CellPadding="0" CellSpacing="0" BorderWidth="0" Width="100%">
				<RowStyle CssClass="filterRow" />
				<AlternatingRowStyle CssClass="filterAltRow" />
			</asp:GridView>
		</div>
	</div>
</asp:Content>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions