jt*****@eudoram ail.com (J) wrote in message news:<e2******* *************** ****@posting.go ogle.com>...
This works well for binding a Dataset (created from an XML file) to a
DataGrid for the entire 'page' table. However I would like to only
grab a few rows from the 'page' table (like: select id, description
from page where docid = 1).
Any help would be greatly appreciated... because this datagrid thing
is kicking my ass.
Thank you,
J
-------------------------------------
dataGrid3.Table Styles.Clear();
DataGridTableSt yle ts1 = new DataGridTableSt yle();
ts1.MappingName = "page";
DataGridColumnS tyle TextCol = new DataGridTextBox Column();
TextCol.Mapping Name = "id";
TextCol.HeaderT ext = "id";
TextCol.Width = 30;
TextCol.ReadOnl y = true;
ts1.GridColumnS tyles.Add(TextC ol);
TextCol = new DataGridTextBox Column();
TextCol.Mapping Name = "DOCID";
TextCol.HeaderT ext = "DOCID";
TextCol.Width = 50;
TextCol.ReadOnl y = false;
ts1.GridColumnS tyles.Add(TextC ol);
dataGrid3.SetDa taBinding(pDS, "page");
dataGrid3.Table Styles.Add (ts1);
CurrencyManager cm = (CurrencyManage r)BindingContex t
[dataGrid1.DataS ource, "page"];
DataView dv = (DataView)cm.Li st;
dv.AllowNew = false;
-------------------------------------
It's amazing what time will do... I've figured this out now. I
believe this is the way you would want to do this (while this dataGrid
this still sucks):
I've modified the above code to show the change:
dataGrid3.Table Styles.Clear();
DataGridTableSt yle ts1 = new DataGridTableSt yle();
ts1.MappingName = "page";
ts1.Alternating BackColor = Color.MediumOrc hid;
DataGridColumnS tyle TextCol = new DataGridTextBox Column();
TextCol.Mapping Name = "id"; //from dataset table
TextCol.HeaderT ext = "id";
TextCol.Width = 30;
TextCol.ReadOnl y = true;
ts1.GridColumnS tyles.Add(TextC ol);
TextCol = new DataGridTextBox Column();
TextCol.Mapping Name = "DOCID"; //from dataset table
TextCol.HeaderT ext = "DOCID";
TextCol.Width = 50;
TextCol.ReadOnl y = false;
ts1.GridColumnS tyles.Add(TextC ol);
dataGrid3.SetDa taBinding(pDS, "page");
dataGrid3.Table Styles.Add (ts1);
dataGrid3.DataM ember = "page";
CurrencyManager cm =
(CurrencyManage r)BindingContex t[dataGrid1.DataS ource, "page"];
DataView dv = (DataView)cm.Li st;
//---------------------------------
//This will 'Filter' the dataset
string txtFilter;
txtFilter = "DOCID=" + g_Cur_D;
dv.RowFilter = txtFilter;
//---------------------------------
dv.AllowNew = false;