This is a migrated thread and some comments may be shown as answers.

Adding more than one relationship to RadGrid in code

1 Answer 17 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ken
Top achievements
Rank 2
Ken asked on 18 Nov 2016, 04:27 PM

Hello,

I have a hiearchal radgrid with a parent level that has 2 key columns.

For example:

ID, Sequence, first_name, last_name

This can result in data that looks like the following:

1, 1, John, Doe
1, 2, Adrian, Shepard
2, 1, Mary, Jane

That child level has:

ID, Sequence, Data

So you can have data that looks like the following:

1, 1, 0.256
1, 2, 0.944
2, 1, 0.109

How can I code the grid so that the child level uses both ID and Sequence as a composite key when the radgrid is built entirely in code?

At the moment I use:

relationFields = New GridRelationFields()
relationFields.MasterKeyField = "ID"
relationFields.DetailKeyField = "ID"
tableView.ParentTableRelation.Add(relationFields)

How do I code it so that it references both ID and Sequence as the relationship so that the grid looks like:

John, Doe
     0.256
Adrian, Shepard
     0.944
Mary, Jane
    0.109

instead of:

John, Doe
     0.256
     0.944
Adrian, Shepard
     0.256
     0.944
Mary, Jane
    0.109

which is wrong, since it is repeating the values on 2 rows because they share the first part of the relationship instead of also considering the second column.

I've looked in the documentation but the only information I've found on creating a composite key relationship involved doing so in the HTML, which is not an option for me as the radgrid is 100% generated in VB code on the server side.

Thanks for any assistance.

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 22 Nov 2016, 01:47 PM
Hello Ken,

I have replied to your query in the support ticket you have submitted and suggest we continue the conversation there. Give the suggestions a try and let me know how they work for you.

With that said, please avoid submitting duplicate threads. This will enable us to keep better track of your support history and provide answers faster.


Regards,
Viktor Tachev
Telerik by Progress
Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
Tags
Grid
Asked by
Ken
Top achievements
Rank 2
Answers by
Viktor Tachev
Telerik team
Share this question
or