TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Bradley George
NA
13
39.7k
Help with creating a filter for a data grid!
Dec 8 2010 4:39 PM
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)
{
}
Reply
Answers (
5
)
Populate whole datagridview column with date
How to send email in Asp.net using smtp.gmail.com as smtp server