Ok, I am creating a standalone C# program. I currenly have the following.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
namespace tmp
{
public partial class frmPlayerSelect : Form
{
DataSet ds = new DataSet();
DataView dvFilter = new DataView();
public frmPlayerSelect()
{
InitializeComponent();
}
private void btnPopulate_Click(object sender, EventArgs e)
{
playerChecklist();
}
private void playerChecklist()
{
//read the XML file
ds.ReadXml("PlayerList.xml");
//Create a DataView for the table
dvFilter.Table = ds.Tables["Player"];
//Set the datasource of the DataGrid to the DataView
dgPlayerList.DataSource = dvFilter;
}
private void txtFilter_TextChanged(object sender, EventArgs e)
{
dvFilter.RowFilter = "Name like '%" + txtFilter.Text + "%'";
//dgPlayerList.DataSource = dvFilter;
}
private void btnSelect_Click(object sender, EventArgs e)
{
}
}
}
What I would like to have happen is the following. I want to populate the DataGrid with data provided by the DataView. I want to use the Dataview to filter data that the DataGrid displays. The XML file holds a list of players. I was to use the DataView to filter results so that selecting a player is easier. So far that part works. But when I select a checkbox (added to the grid before populating) and clear the filter (delete the text in the textbox) the check mark goes away. And vice versa if I check a checkbox before doing the filter.
Any hlep would be greatly appreciated.