DB
Detlef Birkholz
August 28, 2008 07:00 AM UTC
Hi Everyone,
does nobody has any tips?
OK, maybe my cenario is not clear enough. This is what I want to do:
From the NorthWind database I take the tables "Products" and "Categories" which have a foreign key relationship defined on the fields Products.CategoryID and Categories.CategoryID
Now I want to use a GroupingGridControl with a ForeignKeyRefernce, but I can't get it work.
This is what I have so far in my form1_load event:
ggcProducts is of type GridGroupingControl
bsProducts is of type BindingSource
dcNorthWind = New NorthwindDataContext
ggcProducts.Engine.SourceListSet.Add("Categories", dcNorthWind.Categories.ToList)
Dim productsTD As GridTableDescriptor = ggcProducts.TableDescriptor
Dim categoryRD As New GridRelationDescriptor
categoryRD.Name = "Category"
categoryRD.MappingName = "Categories"
categoryRD.RelationKind = RelationKind.ForeignKeyReference
categoryRD.RelationKeys.Add("CategoryID", "CategoryID")
productsTD.Relations.Add(categoryRD)
ggcProducts.DataSource = bsProducts
Dim query = From p In dcNorthWind.Products Select p
bsProducts.DataSource = query
All I get is a Grid with all the columns of the products table, but the CategoryID column is a standard text column with no drop down to chose the values from.
Can anyone give me some hints what I'm doing wrong?
BTW I'm using LINQtoSQL; which is a must for the project I'm evaluating the GroupingGridControl
Yours Detlef
AD
Administrator
Syncfusion Team
August 29, 2008 01:22 PM UTC
Hi Detlef,
Thanks for your interest in Syncfusion products.
You can refer our shipped browser sample that implements the LINQ to SQL feature of 3.5 .NET Framework with our Essential Grouping Grid Control. It generates language-integrated queries for data retrieval, which means that the relational data is represented as objects in these queries. These queries will then be translated into sql queries that interact with the database. The tabular results are then translated back into the objects the user defines. These objects can then be manipulated in our applications, for example they can be bound to a grid control for display.
By using these Language-Integrated Queries, we can get more benefits as of the languages like compile time verification and design time features like IntelliSense.
Here is the link:
\\My Documents\Syncfusion\EssentialStudio\6.3.0.30\Windows\Grid.Grouping.Windows\Samples\2.0\FeaturedSamples\LINQToSQLSample\VB
Also, you refer the browser samples for ForeignKeyReference. Below are the samples:
\\My Documents\Syncfusion\EssentialStudio\6.3.0.30\Windows\Grid.Grouping.Windows\Samples\2.0\RelationsAndHierarchy\ForeignKeyReference\VB
\\My Documents\Syncfusion\EssentialStudio\6.3.0.30\Windows\Grid.Grouping.Windows\Samples\2.0\RelationsAndHierarchy\MultipleColumnForeignKeys\VB
You can refer the ListItemReference relation browser sample which shows the relationkind of ListItemReference. It is an object reference relation for looking up values from a strong typed collection.
\\My Documents\Syncfusion\EssentialStudio\6.3.0.30\Windows\Grid.Grouping.Windows\Samples\2.0\RelationsAndHierarchy\ListItemReference\VB
Please take a look into all the referred samples and let me know if you need any further assistance.
Regards,
Jisha