-
December 8th, 2010, 08:57 PM
#1
Help with creating a filter in a data grid!!
I want to create a filter to filter text in a datagrid as i type in a text box. I have two text boxes, one to filter in text that i type and one to filter out text that i type. I want the data grid to update as i type into either one of the textboxes. Here is some of my code:
private void txtFilterIn_TextChanged(object sender, TextChangedEventArgs e)
{
DataView dv = dgPortStatus.DataContext as DataView;
if (dv != null)
{
if (dv.Table.TableName.ToUpper() == "PORTSTATUS")
{
FilterDataGrid(txtFilterIn.Text, txtFilterOut.Text, _dicPortStatus[cmbGroups.SelectedItem.ToString()]);
}
}
List<QuarantineView> qvList = dgPortStatus.DataContext as List<QuarantineView>;
if (qvList != null)
{
//Filter on quarantine manager
FilterQuarantineViewList(qvList);
}
}
private void btnFilterInClear_Click(object sender, RoutedEventArgs e)
{
txtFilterIn.Clear();
}
private void txtFilterOut_TextChanged(object sender, TextChangedEventArgs e)
{
DataView dv = dgPortStatus.DataContext as DataView;
if (dv != null)
{
if (dv.Table.TableName.ToUpper() == "PORTSTATUS")
{
FilterDataGrid(txtFilterIn.Text, txtFilterOut.Text, _dicPortStatus[cmbGroups.SelectedItem.ToString()]);
}
}
List<QuarantineView> qvList = dgPortStatus.DataContext as List<QuarantineView>;
if (qvList != null)
{
//Filter on Quarantine Manager
FilterQuarantineViewList(qvList);
}
}
private void btnFilterOutClear_Click(object sender, RoutedEventArgs e)
{
txtFilterOut.Clear();
}
//And this method is where my filter needs to go:
private void FilterQuarantineViewList(List<QuarantineView> qvList)
{
}
-
December 9th, 2010, 01:21 PM
#2
Re: Help with creating a filter in a data grid!!
edit your post and add CODE tags... then we'll see what can be done
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
December 9th, 2010, 01:24 PM
#3
Re: Help with creating a filter in a data grid!!
Sorry, It will not let me edit my post.
-
December 9th, 2010, 01:31 PM
#4
Re: Help with creating a filter in a data grid!!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|