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

Child Table Populated Based On Parent Row Data

2 Answers 131 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Pete
Top achievements
Rank 1
Pete asked on 21 Oct 2015, 03:55 PM

 Hi there,

 I apologize if this is answered elsewhere. I tried searching and I couldn't find anything that worked for my need.

 I'm trying to put together a demo project to sell the need for Telerik to the company I work for. The thing I wanted to impress them with was the RadGridViews. In my former job, which feels like a lifetime ago, I worked a lot with the ASP.NET ones, and now I'm trying to work with the WinForm ones and... failing on this issue.

 We currently have a "report" which pulls data from a database using a stored procedure. It's called using a method GetClientInfo and passing in various information (Department and Employee ID). This then fills a DataGridView. When the user finds a Client they want to view they click a button and it loads a second grid underneath containing the Case details of each Client and the total outstanding Bills, GetFileInfo, passing in the ClientNo that it got from the previous grid. What I therefore want to do with the Grid, which I remember doing in the ASP.NET version, is to load the original data into the top level, and then load child rows for the GetFileInfo based on the row.

 It needs to work something like:

GridUnpaidBills.DataSource = GetClientInfo(department, employeeId);

And then, depending on the PLUS they click, it needs to load the child source:

ChildSource = GetFileInfo(GridUnpaidBills.SelectedRows[0].Cells["ClientNo"].Value.ToString());

Does that make sense? I don't know the ClientNo until the PLUS is clicked for that row, so what I was looking for was an On Demand load for the Child, and while I've looked at the help pages and elsewhere I've found various code that sets out a relation using existing tables, but I need to use the method to access the Stored Procedure to retrieve the data as I (currently) have no way of retrieving it otherwise, and I don't want to have to rewrite all the stored procedures for a demo project.

Hopefully I've explained this properly, and hopefully someone can help me out.

Apologies again if it's ridiculously obvious and I'm just not seeing it.

2 Answers, 1 is accepted

Sort by
0
Pete
Top achievements
Rank 1
answered on 21 Oct 2015, 03:58 PM
Replying to remove my email, which was my nickname, from the "Last post by" info...
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 22 Oct 2015, 01:13 PM
Hello Pete,

Thank you for writing.

According to the provided information, it seems that it would be appropriate to use the Load-On-Demand Hierarchy approach.

I hope this information helps. Should you have further questions I would be glad to help.
 
Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Pete
Top achievements
Rank 1
Answers by
Pete
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or