rename columns

  • Thread starter Thread starter Steph
  • Start date Start date
S

Steph

Hello,

I have an ArrayList with some custom objects inside. The type of one
property of this one is an ArrayList too.

When I bind this ArrayList to a datagrid, there is no problem : I can see
all rows and collumns of my object, and the arraylist child.

But when I'm using a way to redefine DataGridTableStyle, in order to rename
fields, I have an error (Mapping name) when I click on the child field.

Do you have an idea ?

Thanks

Steph
 
Post the code. There are a ton of things that could be wrong. Without seeing
how you're doing it, there's no way to know.

Pete
 
Ok :

DataGridTextBoxColumn cs;
DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = typeof(ArrayList).Name;

cs = new DataGridTextBoxColumn();
cs.MappingName = "nomTableUtilisateur";
cs.HeaderText = "Name";
cs.Width = 150;
ts.GridColumnStyles.Add(cs);
// Add the custom tablestyle to the DataGrid
dataGrid1.TableStyles.Clear();
dataGrid1.TableStyles.Add(ts);
dataGrid1.Update();
//bind
dataGrid1.DataSource = myArrTablesSelection;

it seems to be right when I run the code : I can see all the line of my
arraylist. But one field on object included on the arraylist is an
arraylist. I can see the name of this field when I click on the + button,
but suddenly an error appears : can't nomTableUtilisateur because it is an
invalid mapping name.

Thanks for your help

Steph
 
Back
Top