Child Table Populated Based On Parent Row Data

3 posts, 0 answers
  1. Pete
    Pete avatar
    2 posts
    Member since:
    Oct 2015

    Posted 21 Oct 2015 Link to this post

     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. Pete
    Pete avatar
    2 posts
    Member since:
    Oct 2015

    Posted 21 Oct 2015 in reply to Pete Link to this post

    Replying to remove my email, which was my nickname, from the "Last post by" info...
  3. DevCraft R3 2016 release webinar banner
  4. Dess
    Dess avatar
    1561 posts

    Posted 22 Oct 2015 Link to this post

    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.
    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
Back to Top