Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BInd Zero-th index of collection to column

Status
Not open for further replies.

RhythmAddict112

Programmer
Jun 17, 2004
625
US
Hi All,
I've got a object that has a property that is a collection. I have binded a collection of this object to a gridview, and I need to know how to only display the zero-th index of my collection as a column...

pseudo-code

Code:
Dim oUserList as List(Of oUser) = GetUsersList()
Dim gv as GridView
gv.DataSource = oUserList
gv.DataBind()

'Let's say that the .Orders property of the user object is a generic collection

In my GridView, I only want to display the first item in oUser.OrderList.  How can I do this?

 
You bound the collection, not binded.

Create a special property that returns the first object in the collection, which by the way, should be at index 1, not 0.

Arrays start at 0 collections start at 1.


-Sometimes the answer to your question is the hack that works
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top