I'd like to link a nested class as datasource in the Manual Define a Schema functionality.
My class structure is:
Public class Control Public Property Key() As String End Property Public Property Name() As String End Property Public Property Translation() As CTranslation End Propertyend class
Public class Translation Public Property Code() As String End Property Public Property Languages() As List (of Language) End Property Public Property TranslationId() As Integer End Propertyend class
Public class Language Public Property ControlToolTip() As String End Property Public Property LanguageId() As Integer End Property Public Property Text() As String End Propertyend class
I'd like the grid to look like:
Databand ColumnsControl -key -Name -Code -TranslationId -Clanguage -ControlToolTip -LanguageId -Text
Is this possible? If not how to do this by code?
Thnx in Advance!
Hi,
It would be very easy to set up a two-level structure in the UltraDataSource. You simply add a child band to the root band and then add the appropriate columns (the ones you want in the grid) to each band.
You then have two choices. You can either copy the data from your data source into the UltraDataSource all at once. Or, you can use the Load-On-Demand functionality to load the data into the UltraDataSource only as it is needed. For more information on the load-on-demand style, check out the "Virtual Mode Sample" that installs with NetAdvantage either in the UltraWinGrid or UltraDataSource samples.
I was referring to the UltraDataSource as solution and my questions were about the column/band settings. SQL is out of the question in a n-tier application and it would be a pity having to use an intermediate business object/user control. As I can't get the UltraDatasource configured for this kind of structure, it seems an extra business object/LINQ is the way to go.
I don't think there are any samples of this.
How you do it depends on what approach you want to take. As I explained above, there are a lot of different ways you could achieve this. Which one you use depends on the needs of your application.
Which approach were you thinking about taking?
You could probably use SQL to generate a two-table structure in a DataSet, but I'm afraid my SQL is a bit rusty, so you'd need to get assistance from Microsoft if you need help with that.
If you want to keep the data in the same sturcture (with 3 tables), then you will have to either copy the data into some other data source or use UltraDataSource as an intermediary.
You understood my question correctly. Is there an example how such datasource can be designed?
I don't see how you'll define the code/id of Translation in the datasource on the level of Control.Or how you'll define Languages as the first child band. The SDK included examples don't go that far. Does it work on the namespace in the Key value? Or on the namespace of the DataType? Or do I programmatorically assign the property of the object to the column at runtime in some sort of way?
thnx.
I'm not sure I understand what you are asking.
It looks like what you want is for the grid to display the Languages list directly under the Control without displaying the Translatios in between.
You can certainly display this in the grid, but you will need a DataSource that returns the data in the same structure. If you bind the grid to a DataSource with three levels, then the grid will display all three levels, and you cannot hide the second level without also hiding the third.
So you could build an UltraDataSource component that has the structure you want the grid to display and then use that UltraDataSource as a sort've intermediary between your business objects and the grid.
You then have to decide whether you want to simply copy the business object data into the UltraDataSource all at once up front or use the load-on-demand functionality to retrieve the data from your business objects as needed.