Wrox Programmer Forums
|
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 24th, 2016, 07:21 PM
Registered User
 
Join Date: May 2016
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Data filtering

how can I create the filter itself and to set filtering conditions using already described IFilter interface. I am using Dapfor .Net grid.
 
Old May 24th, 2016, 07:28 PM
Registered User
 
Join Date: May 2016
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by maplecutie View Post
how can I create the filter itself and to set filtering conditions using already described IFilter interface. I am using Dapfor .Net grid.
//User control for editing a filter.
public partial class CustomFilterControl : UserControl
{
private IWindowsFormsEditorService _service;
private CustomFilter _filterEditor;
private IFilter _currentFilter;

public CustomFilterControl()
{
InitializeComponent();
}

public IFilter CurrentFilter
{
get { return _currentFilter; }
}

public void EditFilter(IWindowsFormsEditorService service, CustomFilter filterEditor)
{
if (service != null)
{
//Display the control
_filterEditor = filterEditor;
_service = service;
service.DropDownControl(this);
}
}

//Called when the user clicks on the 'Ok' button
private void buttonOk_Click(object sender, EventArgs e)
{
if (_service != null)
{
//Create a filter and keep it in the _currentFilter variable
double minValue = (double)minValueCtrl.Value;
double maxValue = (double)maxValueCtrl.Value;
_currentFilter = new Ui.Filter(delegate(Row row)
{
double price = (double) row["Price"].Value;
if (minValue > 0 && price < minValue)
{
//filter the row, if the value less than the minValue.
return true;
}
if (maxValue > 0 && price > maxValue)
{
//filter the row, if the value less than the minValue.
return true;
}
return false;
});

//Close the dropdown control
_service.CloseDropDown();
}
}
}
The Following User Says Thank You to sobort84 For This Useful Post:





Similar Threads
Thread Thread Starter Forum Replies Last Post
Filtering data Erik Severiens BOOK: Beginning ASP.NET 4 : in C# and VB 6 June 6th, 2013 11:21 AM
Filtering XML data aldwinenriquez XSLT 7 August 25th, 2008 03:24 AM
Filtering Data after its been cached Durkee VB.NET 2002/2003 Basics 0 November 13th, 2007 05:57 PM
data filtering from combobox MAKO C# 4 June 1st, 2006 03:54 AM
Need Help on Filtering duplicated data fanyin XSLT 2 November 4th, 2004 08:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.