Hey there,

Mappingname must match the name of a collection class. As you know, your problem occurs because both your collections ( the original array, and the class member ) are both ArrayLists.

To solve your problem, you must change one of your collections to something other than a ListArray.

 

Here are two solutions:

1. Copy the elements of the original array from an ArrayList to an array of objects before setting as data source for data grid.

 

MyClass[] myClassArray = new MyClass[arrayList.Count];

for ( int i=0; i < myClassArray.Length; i++ )

  myClassArray[i] = (MyClass) arrayList[i];

 

dataGrid1.DataSource = myClassArray;

dataGridStyle.MappingName = "MyClass[]";

 

< and for the table style of the member array list, dataGridStyle2.MappingName = “ArrayList” >

 

2. Or, you could implement any of the two Array Lists as a custom collection instead, by implementing ICollection,

public MyCollectionClass : ICollection

{ … }

dataGridStyle.MappingName = “MyCustomCollection”;


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Evan Brown
Sent: May 21, 2004 3:20 PM
To: [EMAIL PROTECTED]
Subject: [clug-talk] OT: CSharp Question

 

I know this is a question most foul, asking about C# in this list but I need some help and google isn’t cutting it. Anyone with C# experience that wants to let me ask them a few questions?

 

I have an ArrayList of a class, that class has a member ArrayList. I can feed the Arraylist of classes to a datagrid and it displays the classes with a + sign next to each one when you click on that the row expands and shows the sub Arraylists data. Okay that’s great, but if I want to set the TableStyle I set the mappingname = ArrayList . Now when I go to open the sub array list it craps out and tells me basically that it can’t apply the associated columnstyles that correspond the the main arraylist to the subarray list which makes sense but I also can’t create another tablestyle with the mappingname = arraylist . What can I do?? Anyone

 

Evan Brown

_______________________________________________
clug-talk mailing list
[EMAIL PROTECTED]
http://clug.ca/mailman/listinfo/clug-talk_clug.ca

Reply via email to