S
Steph
Hello,
I have a problem to bind my arrayList to a datagrid. I have read the article
on MSDN but I dont ' understand where is the bug.
I have 2 classes : DataTableUser and DataFieldUser. One field's type of
DataTableUser is an ArrayList of DataFieldUser; others type are string.
I have one ArrayList with some DataTableUser in.
I bind this arrayList to a datagrid, no problem. So I want now rename Header
Text and try this following code :
....
DataGridTextBoxColumn cs;
DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = typeof(ArrayList).Name;
cs = new DataGridTextBoxColumn();
cs.MappingName = "nameDataTableUser";
cs.HeaderText = "name";
cs.Width = 150;
ts.GridColumnStyles.Add(cs);
cs = new DataGridTextBoxColumn();
cs.MappingName = "typeDataTableUser";
cs.HeaderText = "type";
cs.Width = 150;
ts.GridColumnStyles.Add(cs);
cs = new DataGridTextBoxColumn();
cs.MappingName = "infoDataTableUser";
cs.HeaderText = "Info";
cs.Width = 150;
ts.GridColumnStyles.Add(cs);
// Add the custom tablestyle to the DataGrid
dataGrid1.TableStyles.Clear();
dataGrid1.TableStyles.Add(ts);
....
At this time, it's ok, but :
"type" has a + on the datagrid (because it is an ArrayList) and when I click
on it I have a "System.IvalidOperationException".
What can I do ?
Thanks for your help
I have a problem to bind my arrayList to a datagrid. I have read the article
on MSDN but I dont ' understand where is the bug.
I have 2 classes : DataTableUser and DataFieldUser. One field's type of
DataTableUser is an ArrayList of DataFieldUser; others type are string.
I have one ArrayList with some DataTableUser in.
I bind this arrayList to a datagrid, no problem. So I want now rename Header
Text and try this following code :
....
DataGridTextBoxColumn cs;
DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = typeof(ArrayList).Name;
cs = new DataGridTextBoxColumn();
cs.MappingName = "nameDataTableUser";
cs.HeaderText = "name";
cs.Width = 150;
ts.GridColumnStyles.Add(cs);
cs = new DataGridTextBoxColumn();
cs.MappingName = "typeDataTableUser";
cs.HeaderText = "type";
cs.Width = 150;
ts.GridColumnStyles.Add(cs);
cs = new DataGridTextBoxColumn();
cs.MappingName = "infoDataTableUser";
cs.HeaderText = "Info";
cs.Width = 150;
ts.GridColumnStyles.Add(cs);
// Add the custom tablestyle to the DataGrid
dataGrid1.TableStyles.Clear();
dataGrid1.TableStyles.Add(ts);
....
At this time, it's ok, but :
"type" has a + on the datagrid (because it is an ArrayList) and when I click
on it I have a "System.IvalidOperationException".
What can I do ?
Thanks for your help