We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

LINQToSQL and ListItemReference or ForeignKeyReference

Thread ID:

Created:

Updated:

Platform:

Replies:

76172 Aug 26,2008 08:04 AM UTC Aug 29,2008 01:22 PM UTC WinForms 2
loading
Tags: GridControl
Detlef Birkholz
Asked On August 26, 2008 08:04 AM UTC

Hi Everybody,

based on the LINQToSQL sample provided with syncfusions essential grid I would like to implement a foreignkeyreference for a lookup table.

Therefore I took the ListItemRefernce part of the sample. Now I would like the CategoryID column behave like in the samples for ForeignKeyReference (i.e. have a dropdown box to chose the values from).

But I can't figure out how to do it. Can anyone give me some hints?

Yours
Detlef


Detlef Birkholz
Replied On 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



Administrator [Syncfusion]
Replied On 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



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;