Showing results for 
Search instead for 
Do you mean 

Custom Entity in DataGridView

Tuned Listener
Posts: 44
Country: Canada

Custom Entity in DataGridView

Hey Everyone, Need some advice or options if anyone can think of anything. I am using the DataGridView to show a list of all the custom entities for all the contacts, it is a master list using the code below. It works great and shows me a list of all the custom sub entities and there fields, the problem is I want a column that shows the contact name of who the entity is linked to, however the list only shows the fields that belong to the custom entity. I tried adding an unbound column and then go through each row, and use the customsubentity.getcontacts to get the names of the linked contact and then add it to that new column, but it is very very slow, especially if you have thousands of records. Anyone have a better way I can handle this, or have done something similar in the past. All I want is a grid of all the custom sub entities with there field data and a contact column showing the contact who it belongs to. Any help is greatly appreciated.



                Dim manager As CustomSubEntityManager(Of Act.Framework.CustomEntities.CustomSubEntity) = Me.actApplication.ActFramework.CustomEntities.GetSubEntityManager(Of Act.Framework.CustomEntities.CustomSubEntity)(entityName)


                    Dim customSubEntities As CustomEntityList(Of Act.Framework.CustomEntities.CustomSubEntity) = Nothing

                  customSubEntities = manager.GetCustomEntities(Nothing, Nothing)


  Dim fields As CustomEntityFieldDescriptor() = manager.GetCustomEntityFieldDescriptors()

                        For i As Integer = 0 To fields.Length - 1




                 Me.DataGridView.DataSource = customSubEntities

Bronze Super Contributor
Posts: 1,284
Country: USA

Re: Custom Entity in DataGridView



Use the loading row event to populate the contact name when the row becomes visible.

This will get you out of populating all the entity items at eon time.


Downside: If the user sets the order of the grid to that column then you need to load all the rows anyway.


Long range solution: write a SQL statement to join the custom table and the contact table. But remember you can have multiple contacts attached to a single entity.


-- Jim Durkin