Devexpress xtragrid binding

Posts   
 
    
rapido
User
Posts: 45
Joined: 10-Apr-2009
# Posted on: 23-Apr-2009 03:15:46   

Dim products As New ProductEntity(CInt(txtProductID.Text.ToString)) TextBox1.Text = products.ProductId 'no problem with this

'why is it that i can't bind products entity to the grid control with the code below? OrderLinesDataGridView.DataSource = products

'pls. help

the code above is just for one record right? how do i bind an entire table to a bound control like a grid? if it's possible what if there are new records added to the grid, how can it be saved on the entity?

'for a textbox dim orders as new OrderEntity() orders.productid=textbox1.text

'for a grid ???????

advance tnx for the help.

rapido
User
Posts: 45
Joined: 10-Apr-2009
# Posted on: 23-Apr-2009 03:25:27   

i tried

' dim products as new ProductCollection xtragrid1.datasource= products

' but it only changes the column header of the grid to the entity fields 'but no records are displayed

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Apr-2009 07:20:04   
Dim products As New ProductEntity(CInt(txtProductID.Text.ToString))

You should use **ProductCollection **instead of ProductEntity, when binding to a grid.

Dim products as new ProductCollection
xtragrid1.datasource= products

You need to fetch the data (products.GetMulti(Nothing)).

I recommend you to read these manual sections: - Using the EntityCollection classes - Databinding with ASP.Net2.0 - Databinding with Windows Forms

David Elizondo | LLBLGen Support Team
rapido
User
Posts: 45
Joined: 10-Apr-2009
# Posted on: 23-Apr-2009 07:41:09   

thanks for the quick reply! yap, i used productcollection instead of entity but the grid just displayed the entity names on the column headers of the grid, no record, when i checked the table it has 10 records which i manually added before.

rapido
User
Posts: 45
Joined: 10-Apr-2009
# Posted on: 23-Apr-2009 07:50:26   

Thanks daelmo! got it. I'm always hesitant on this forum to ask easy questions regarding windows apps, i know most developers are going into web apps, but what can i do,sometimes i can't figure easy ones coz that's what my mind is capable of, but thanks for the support team in patiently answering my easy questions, coz it's really hard on my part.