473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Datagrid displaying related ArrayLists

Hi,
I have two classes, Department and Employer, the Department contains an
ArrayList (employers) filled with Employer objects. I want to display an
ArrayList filled with Department objects using a Datagrid. Therefor, I do a
setDatabinding with the Deparments ArrayList and I create two
DatagridTableStyle objects, both with mappingname "ArrayList", and add them
to the Datagrid. However, if I want to add the second DatagridTableStyle, I
get the exception that a table with mappingname "ArrayList" already exists
(makes sense). If I change the Deparment ArrayList to a strongly type array
Department[], and change the mappingname accordingly all works well, of
course. (great feature by the way). I want to know whether it is possible to
display this kind of objectstructure using just ArrayLists.

kind regards,
Christiaan
Nov 15 '05 #1
4 1601
Hi Christiaan,

Thanks for posting in the group. We are currently researching on this issue
and will update your ASAP.

If there is anything unclear, please feel free to post in the community and
we will follow up.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 15 '05 #2
thnx, I would appreciate that!

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:L#**************@cpmsftngxa07.phx.gbl...
Hi Christiaan,

Thanks for posting in the group. We are currently researching on this issue and will update your ASAP.

If there is anything unclear, please feel free to post in the community and we will follow up.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 15 '05 #3

Hi Christiaan,

Thank you for posting in the community!

Based on my understanding, you want to specify 2 ArrayLists of
DatagridTableStyle for the same datagrid.

==========================================
If you want to bind your datagrid to arraylist object, all items in the
arraylist must be of the same type as the first item. And when binding to
an ArrayList, you must set the MappingName of the DataGridTableStyle to
"ArrayList" (the type name).

In the document of GridTableStylesCollection class, you will see that:
"CAUTION ...... Consequently, an exception will be thrown if you try to
add new DataGridColumnStyle objects with duplicate MappingName values to
the GridColumnStylesCollection. Alternatively, clear the
GridColumnStylesCollection using the Clear method."
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemwindowsformsgridtablestylescollectioncl asstopic.asp

So DataGrid.TableStyles does not support 2 DatagridTableStyles with the
same MappingName.

I think your workaround of using array is a simple and good.

Another workaround I can think of is creating a new class which inherited
from the ArrayList class, then you can specify different MappingName.

============================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Have a nice day!!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #4

Hi Christiaan,

Does my reply make sense to you?
If you still have anything unclear, please feel free to tell me, I will
help you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Stephen | last post by:
I've got a datagrid with a remove button and I would like to add some code in the code behind page so as whenthe button is clicked the corresponding row in the datagrid is removed. The Datagrid is...
0
by: Christiaan | last post by:
Hi, I have two classes, Department and Employer, the Department contains an ArrayList (employers) filled with Employer objects. I want to display an ArrayList filled with Department objects using...
2
by: pmcguire | last post by:
I have a form displaying information from one record in a datatable and a datagrid displaying "child" information from records in another, related, datatable. I have added a DatagridTableStyle so...
1
by: Chuen | last post by:
Hi, If I use datagrid to operate dataset, my problems is how to display a column value with its related other value. I means: suppose there are two tables in dataset, table1: id name 1 "IBM"...
5
by: Rami | last post by:
Hey, I Tried to bind a DataGrid to an ArrayList, and had 2 problems: 1. The DataGrid shows the Length property of the items instead of their text - how can I change that? 2. After binding, I add...
16
by: stojilcoviz | last post by:
I've a datagrid whose datasource is an arraylist object. The arraylist holds many instances of a specific class. I've two questions about this: 1 - Is there a way by which I can obtain a...
1
by: jwogick | last post by:
I'm hoping someone can help me! I just have a simple form with a datagrid displaying child records from a dataset that contains two related tables Parent table>Clients Child table>cases. using the...
6
by: p.mc | last post by:
Hi all, I'm having major problems with a userControl which contains a datagrid. My problem concerns data binding. The Page_Load() procedure calls the DataBind procedure to bind the datagrid...
0
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.