-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Populating ASP.NET's GridView with list of object[]
PostPosted: Thu Apr 13, 2006 3:47 pm 
Newbie

Joined: Mon Jan 30, 2006 6:33 pm
Posts: 9
Hello,
I am trying to populate a ASP.NET GridView with a List of object-arrays which I query with HQL.
The problem ist that the GridView doesn't display the elements of the objects as colums but displays some properteis of an array:
Length Rank IsReadOnly IsFixedSize IsSynchronized LongLength

Does someone know how to solve this issue? I would really appreciate it. :)

Thank you
Max


Top
 Profile  
 
 Post subject: List of Object Arrays....
PostPosted: Thu Apr 13, 2006 9:46 pm 
Regular
Regular

Joined: Fri Jul 29, 2005 9:46 am
Posts: 101
Hi!
So you basically have a kind of jagged array (http://www.csharphelp.com/archives/archive93.html) and AFAIK the GridView does not support jagged arrays (http://www.asp.net/QuickStart/aspnet/do ... dview.aspx)

ArrayList jaggedArray= new ArrayList()
object[] array1 = new object[]{"A","B","C"};
object[] array2 = new object[]{"C","D","E"};
jaggedArray.Add(array1);
jaggedArray.Add(array2 );

Well, if you are sure that all the arrays inside you jagged array always
have the same lenght, and each "colum" alwas has a meaning... you could change and use a custom row class

ArrayList masterArray= new ArrayList()
CustomRowClass row1 = new RowClas("A","B","C")
CustomRowClass row2 = new RowClas("C","D","E")
jaggedArray.Add(row1);
jaggedArray.Add(row2);


Another option could be tranforming your jagged array into a
custom built datatable....


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 14, 2006 3:15 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
You could create a DTO class that has properties that represent the values you are returning from your hql statment and populate it with the SELECT NEW hql syntax.

Symon.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.